<script type="text/javascript">
function reinitIframe(){
//高度适应
var iframe = document.getElementById("personiframe");
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){}
//宽度适应
try{
var fwidth = iframe.contentWindow.document.body.scrollWidth;
var dwidth = iframe.contentWindow.document.documentElement.scrollWidth;
var ffwidth = Math.max(fwidth, dwidth);
iframe.width = ffwidth;
}catch (ex){}
}
window.setInterval("reinitIframe()", 200);
</script>
iframe只适应大小。ps:在ie和ff通过测试
最新推荐文章于 2024-07-21 22:13:29 发布