如果里面不确定,可以在加载完iframe里的页面的body中的onload写
parent.document.getElementById("div的id").style.height=parent.document.getElementById("iframe的id").style.height
parent.document.getElementById("div的id").style.height=parent.document.getElementById("iframe的id").style.height
-----------------------------------------------------------------------------------------------------------------------------------------------------
javascript代码如下:
function change_size()
{
document.getElementById("info_iframe").style.height=info_content.document.body.scrollHeight+1+"px";
}<iframe marginheight="0" marginwidth="0" src="table.html" frameborder="0" scrolling="no" width="553" id="info_iframe" name="info_content" onload="change_size()"></iframe>
请问如何在IE5中也能实现要求的功能?
div让它自己撑大好了.iframe的高度可以自适应.
在子页面里加入:
function _setHeight()
{
window.frameElement.height = document.body.scrollHeight + 30 ;//设高度并调整一下误差
}window.attachEvent( "onload" , setHeight ) ;