iframe高度自适应
2015-02-27 11:01
141 查看
function reinitIframe(fr){
var iframe = document.getElementById(fr);
try{
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
var height = Math.max(bHeight, dHeight);
iframe.height = height;
}catch (ex){}
}
<iframe id="the2" src="../living.html" width="640" height="100%" style="overflow-y: scroll" frameborder="0" scrolling="Auto"></iframe>
<script type="text/javascript">
window.setInterval("reinitIframe('the2')", 200);
</script>
var iframe = document.getElementById(fr);
try{
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
var height = Math.max(bHeight, dHeight);
iframe.height = height;
}catch (ex){}
}
<iframe id="the2" src="../living.html" width="640" height="100%" style="overflow-y: scroll" frameborder="0" scrolling="Auto"></iframe>
<script type="text/javascript">
window.setInterval("reinitIframe('the2')", 200);
</script>
相关文章推荐
- iframe自适应窗口高度
- iframe的宽度和高度自适应
- iframe自适应高度
- iframe自适应高度的多种方法方法小结
- iframe自适应高度的超精简方法 IE6/7/8/9 & FF经测试完全通过
- 【转】三谈Iframe自适应高度
- iframe 高度自适应完美解决方案
- 同域iframe的高度自适应
- jQuery处理自适应内容高度的iframe
- JS实现iframe自适应高度的方法示例
- js控制iframe的高度/宽度让其自适应内容
- 兼容主流浏览器的iframe自适应高度js脚本
- iframe自适应高度
- JS实现iframe自适应高度的方法(兼容IE与FireFox)
- iframe自适应高度?
- 开发小技巧:jQuery处理自适应内容高度的iframe
- 跨域iframe的高度自适应
- iframe自适应网页内容的高度
- 关于IFRAME 自适应高度的研究-表单特效
- 让iframe简单有效自适应高度