我要写一个页面 有个文本框 输入URL 就创建一个iframe
再通过本页面给iframe注册函数 会出现 拒绝访问
url 是跨域的
function frameLoad(id) {
window.frames[id].document.write("<script type=\"text/javascript\" scr=\"http://localhost:53534/netCenter/js/include.htm\" ><\/script>"); }
再通过本页面给iframe注册函数 会出现 拒绝访问
url 是跨域的
function frameLoad(id) {
window.frames[id].document.write("<script type=\"text/javascript\" scr=\"http://localhost:53534/netCenter/js/include.htm\" ><\/script>"); }
解决方案 »
- extjs获取第一列的el
- 求助:如何在页面判断Windows应用程序是否安装?
- javascipt是不是不支持variant呀,我都可以送出来,就是取不到
- js onDblClick对js生成表赋值
- 怎么在 iframe 里调用本地文件
- 再问梅花雪
- JavaScript 能实现函数重载吗?
- 页面返回问题
- 如何得到<td>中含有HTML标签的值?如<tr onclick="alert('test.value')"><td><input type="checkbox" name="test" value="345"></td></tr
- 這個問題誰知道--關于框架的大小
- js中的程序不明白?
- js的原型方法可以直接调用!
var divTag = 10;
function setlocation(obj) {
divTag++;
var url = document.getElementById(obj).value;
var newDIV = document.createElement("div");
newDIV.setAttribute("dname", "content_div_" + divTag);
if(url.indexOf("//")<=0){
url = "http://" + url;
}
document.body.appendChild(newDIV);
showContent(newDIV.dname);
newDIV.innerHTML = "<iframe width=\"100%\" id=\"content_frame_" + divTag + "\" src=\"" + url + "\" onload=\"frameLoad(this.id)\" ></iframe>";
} function frameLoad(id) {debugger
window.frames[id].document.write("<script type=\"text/javascript\" scr=\"http://localhost:53534/netCenter/js/include.htm\" ><\/script>"); }<input type="text" id="txturl" /><input type="button" onclick="setlocation('txtUrl')" />
比如: 在文本框输入 www.baidu.com
就创建一个iframe 在iframe的onload事件中调用frameLoad 函数
红色部分会出错
那貌似就是传说中的黑客了吧
就是不跨域的话 也有问题呀 破坏原来的页面了呀
好主意 今天刚刚 看了 Google 和 Opera 浏览器 我可以直接 用 js写个浏览器 哈哈哈 谢谢
var strHTML = "<html><body>内容。。<body></html>";
如何将strHTML的内容加到iframe中