iframe自适应高度详解

主页面代码示例:

<iframe id="frame_content" src="iframe_b.html" scrolling="no" frameborder="0"></iframe>

<script type="text/javascript">
function reinitIframe(){
var iframe = document.getElementById("frame_content");
try{
iframe.height =  iframe.contentWindow.document.documentElement.scrollHeight;
}catch (ex){}
}
window.setInterval("reinitIframe()", 200);
</script>

 

原文出处:http://bbs.blueidea.com/thread-2902341-1-1.html

posted @ 2013-10-30 15:13  小郑  阅读(176)  评论(0编辑  收藏  举报