<iframe src="http://www.z6.net.cn" frameborder="0" scrolling="no" id="iframepage" onLoad="iFrameHeight()" style="width:100%;"></iframe>
<script>
function iFrameHeight(){
var ifm= document.getElementById("iframepage");
var subWeb = document.frames ? document.frames["iframepage"].document : ifm.contentDocument;
if(ifm != null && subWeb != null) {
ifm.height = subWeb.body.scrollHeight;
}
}
</script>
未经允许不得转载:任鹏个人博客 » JS 获取iframe内容高度的方法

