如果里面不确定,可以在加载完iframe里的页面的body中的onload写
parent.document.getElementById("div的id").style.height=parent.document.getElementById("iframe的id").style.height

解决方案 »

  1.   

    找到一段这样的代码,可以在IE6/IE5.5上面实现要求的功能,但在IE5中就不起作用了....
    -----------------------------------------------------------------------------------------------------------------------------------------------------
    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中也能实现要求的功能?
      

  2.   

    何必如此.
    div让它自己撑大好了.iframe的高度可以自适应.
    在子页面里加入:
    function _setHeight()
    {
    window.frameElement.height = document.body.scrollHeight + 30 ;//设高度并调整一下误差
    }window.attachEvent( "onload" , setHeight ) ;
      

  3.   

    frameElement 是 获取在父文档中生成 window 的 frame 或 iframe 对象。