<iframe id="mainFrame" width="100%" scrolling="no" height="445" frameborder="0" src="user_manage.asp"></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>
本文介绍了一种使用JavaScript定期调整iframe元素高度的方法,确保其能够根据内容动态改变高度,避免出现滚动条或空白区域。
1万+

被折叠的 条评论
为什么被折叠?



