当前位置:Gxlcms > JavaScript > 通过ifame指向的页面高度调整iframe的高度

通过ifame指向的页面高度调整iframe的高度

时间:2021-07-01 10:21:17 帮助过:19人阅读

通过ifame指向的页面高度调整iframe的高度
1.htm的代码:  
<iframe  src=2.htm  id=ifrm></iframe>  

2.htm的代码:   
<script>  
function  resize()  
{parent.document.all.ifrm.height=document.body.scrollHeight;
parent.document.all.ifrm.width=document.body.scrollWidth;
}  
</script>
<body  onload="resize()">  
</body>

人气教程排行