<iframe id="content" width="100%" height="100%" allowtransparency="true" frameborder="0" scrolling="no" src='.............'></iframe>
function easeHeight() {
var bHeight = document.body.scrollHeight;var dHeight = document.documentElement.scrollHeight;
var height = Math.max(bHeight, dHeight);
parent.document.getElementById("content")
.getElementsByTagName("iframe")[0].style.height = height + "px";
}
子页面设置自适应方式
=================================================================
<iframe id="content" width="100%" height="100%" allowtransparency="true" frameborder="0" scrolling="no" src="。。。。。。。。"></iframe>
<script type="text/javascript">
function reinitIframe(){
var iframe = document.getElementById("content");
try{
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
var height = Math.max(bHeight, dHeight);
iframe.style.height = height+"px";
}catch (ex){}
}
window.setInterval("reinitIframe()", 200);
</script>
</div>