您的位置:首页 > 其它

关于IFrame的高度问题的解决(避开滚动条)

2013-04-08 15:44 267 查看
http://www.kuqin.com/webpagedesign/20080516/8536.html 原创链接,由于里面有例子,转载的时候麻烦,所以此处注明

<iframe id="frame_content" src="iframe_b.html" scrolling="no" frameborder="0"
onload="this.height=100"></iframe>
<script type="text/javascript">
function reinitIframe(){
var iframe = document.getElementById("frame_content");
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){}
}
window.setInterval("reinitIframe()", 200);
</script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐