Iframe自适应高度绝对好使的代码IE,遨游,火狐都兼容,测试过

iframe自适应高度脚本
<script type="text/javascript">

function reinitIframe(){

var iframe = document.getElementById("mainFrame");

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>
原文地址:https://www.cnblogs.com/hanguoji/p/1945648.html