Apr
17
1.在包含Iframe的页面:
<iframe name="iframe1" src="main.jsp" width="557px" height="100%" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" onload="this.height=iframe1.contentWindow.document.body.scrollHeight"></iframe>
关键语句在于onload="this.height=this.document.body.scrollHeight"。
2.在包含Iframe的页面:
<iframe name="iframe1" src="main.asp" width="557px" height="100%" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" onload="getHeight()"></iframe>
然后在每个要在Iframe中显示的页面底部加入
<div id="End"></div>
<script language="JavaScript">
function getHeight(){
iframe1.height=document.getElementById("End").offsetTop+10;
}
</script>
<script language="JavaScript">
function getHeight(){
iframe1.height=document.getElementById("End").offsetTop+10;
}
</script>
利剑之辉在家电论坛买了一
小沈阳版程序员



