Posted on 2008-08-03 01:04
七郎归来 阅读(334)
评论(0) 编辑 收藏
方法1:
<iframe name="iframe" src="0206showOperationLog.jsp" height="0" frameborder="0" scrolling="no" width="800"
onload = "height = document.frames(this.name).document.body.scrollHeight">
</iframe>
height="0"的作用为开始没有数据时 iframe不显示
方法2:
<iframe id="frame_content" src="iframe_b.html" scrolling="no" frameborder="0" onload="this.height=100"></iframe>
<script type="text/javascript">
function reinitIframe(){
var iframe = document.getElementById("frame_content");
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>