原文地址1
地址2
<iframe id="frame_content" src="iframe_b.html" scrolling="no" frameborder="0"
onload="this.height=100"></iframe>
<script type="text/javascript">
var cbHeight = 0;
var cdHeight = 0;
function reinitIframe(){
var iframe = document.getElementById("frame_content");
try{
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
if (bHeight != cbHeight || dHeight != cdHeight) {
iframe.height = 100;
bHeight = iframe.contentWindow.document.body.scrollHeight;
dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
iframe.height=Math.max(bHeight, dHeight);
cbHeight = bHeight;
cdHeight = dHeight;
}
}catch (ex){}
}
window.setInterval(reinitIframe, 200);
</script>
分享到:
相关推荐
iframe 自适应高度iframe 自适应高度iframe 自适应高度iframe 自适应高度iframe 自适应高度iframe 自适应高度iframe 自适应高度iframe 自适应高度
iframe自适应高度(兼容多种浏览器) 亲测可以
iframe自适应高度和宽度
纯JS实现的iframe自适应高度。兼容主流浏览器。
iframe自适应高度说明文档iframe自适应高度说明文档iframe自适应高度说明文档iframe自适应高度说明文档iframe自适应高度说明文档iframe自适应高度说明文档iframe自适应高度说明文档iframe自适应高度说明文档iframe...
因为有一个项目要用到iframe自适应高度,网上搜索了以下结果无数,不过看来看去都是那几个,而且基本都测试了一遍,所说的兼容根本不是那么回事,要不IE不正常,要不其他浏览器显示不正常,最后无奈,综合网上的方法...
iframe自适应高度 .txtiframe自适应高度 .txtiframe自适应高度 .txtiframe自适应高度 .txtiframe自适应高度 .txt
jquery对iframe自适应高度插件是国外下载下来的。插件使用只要引用js文件就行,不用做任何别的操作完全自动化。
Iframe自动根据类容改变自己的大小,解决Iframe设置高度后无法缩小!拜一个高人所赐,特表示感谢!
这个库允许的高度与同跨域iframe来适应他们所包含的内容的宽度自动调整大小。它最常见的问题与使用iframes提供一系列的功能,其中包括: 高度和宽度大小的iframe内容大小。 作品以多个嵌套的iframe。 跨域iframe域...
iframe自适应高度
javascript iframe 自适应高度js demo
多层嵌套iframe 自适应高度的解决方法
iframe自适应高度的简单解决办法,word文档中有详细的解释,赶快下载吧!
介绍: 填写的嵌入地址一定要和本页面在同一个站点上,否则会提示“拒绝访问!”。对跨域引用有权限问题,请查阅其他资料。
iframe自适应高度(DOM动态操作)
iframe自适应高度 .doc
iframe自适应高度:根据屏幕的高度,自动增减。包括适应浏览器高度的改变。
iframe自适应高度兼容各主流浏览器,经本人亲手测试。 通过测试的浏览器:IE/Firefox/Chrome/Opera/Safari 注:此方法不支持DOM动态操作 版本太旧,自行选择