问了N天,还是问同一个问题.IFRAME的高度自适应(请高手作答,有劳!) 脚本是不可以跨域操作的, 即你调用远程的页面时JS没有办法访问 iframe 里加载的页面. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://community.csdn.net/Expert/FAQ/FAQ_Index.asp?id=204846 function iframeAutoFit() { if(self!=top && window.name=="Owner") { var iframe = parent.document.getElementById(window.name); if(iframe) { iframe.parentNode.style.height = iframe.style.height; iframe.style.height = 10; var h = document.body.scrollHeight; var minimalHeight = parseInt((window.screen.width*11)/16, 10) - 280; h = h<minimalHeight ? minimalHeight : h; if(window.navigator.appName == "Microsoft Internet Explorer" && iframe.frameBorder=="1") h += 4; iframe.parentNode.style.height = iframe.style.height = h; } else alert("Iframe's id unequal to iframe's name!"); } } if(document.attachEvent) window.attachEvent("onload", iframeAutoFit); else window.addEventListener('load', iframeAutoFit, false); 中window.screen.width*11)/16是什么意思?取什么值? window.screen.width*11)/16是什么意思?取什么值? 以下是a.html的内容<iframe src="http://www.b.com/b.htm" > </iframe> www.b.com/b.htm:<body onload="window.resizeTo(document.body.scrollWidth+10,document.body.scrollHeight+10);">fdsafdsafd</body> 跨域的frame你是没有权限调整大小的。解决方法除非你在自己的域下写一个动态脚本文件,然后动态抓取远程的这个文件。 js怎样实现这样的图片功能 Ext4.0 combobox内嵌到grid的问题 如何实现B/S聊天室中向服务器发送聊天信息? 怎么让文本框里按回车去点击一个链接呢? js 自定义函数 200分,谁能帮我解答一下这个乱码的问题,谢谢 Cookie访问目录问题。 js初学者笔记之一:模拟访问父类的保护变量 点击链接之后,2秒再进入页面的问题~ 欢迎关注 请大家帮忙看看!谢谢! 如何取值,再线等待!!!! IE浏览器怎么会有这个错误
{
if(self!=top && window.name=="Owner")
{
var iframe = parent.document.getElementById(window.name);
if(iframe)
{
iframe.parentNode.style.height = iframe.style.height;
iframe.style.height = 10;
var h = document.body.scrollHeight;
var minimalHeight = parseInt((window.screen.width*11)/16, 10) - 280;
h = h<minimalHeight ? minimalHeight : h;
if(window.navigator.appName == "Microsoft Internet Explorer"
&& iframe.frameBorder=="1") h += 4;
iframe.parentNode.style.height = iframe.style.height = h;
}
else alert("Iframe's id unequal to iframe's name!");
}
}
if(document.attachEvent) window.attachEvent("onload", iframeAutoFit);
else window.addEventListener('load', iframeAutoFit, false);
中window.screen.width*11)/16是什么意思?取什么值?
</iframe> www.b.com/b.htm:
<body onload="window.resizeTo(document.body.scrollWidth+10,document.body.scrollHeight+10);">
fdsafdsafd
</body>