问题说明:
      我的一个index.aspx页面中包行了3个iframe 其中左边和右边的iframe的高度是不变的,只有中间那个iframe的高度要适应不同页面的高度,但他变高的时候不能缩回去。
望知道的同行给个解决方案,在这小弟先谢谢了。。

解决方案 »

  1.   

    <IFRAME id="main" name="main" marginWidth="10" marginHeight=0 src="iframe.php" frameBorder=0 width=100% scrolling=no height=25 onload="this.height=this.contentWindow.document.body.scrollHeight"></IFRAME>
      

  2.   

    就是中间的那个iframe里面套的页面变高之后,再点击别的没那么高的页面它不会缩回去。。
      

  3.   

    <iframe marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" 
    id="frameCenter" scrolling="no" src="frame.htm" 
    onload="style.width=this.contentWindow.document.all.formTableID.offsetWidth;"
    +"style.height=this.contentWindow.document.all.formTableID.offsetHeight"></iframe>formTableID是你调用那二个页面最外层的table的id
      

  4.   

    //自动适应iframe的高度适用IE FF
     function SetWinHeight(obj)
    {
        var win=obj;
        if (document.getElementById)
        {
            if (win && !window.opera)
            {
               if (win.contentDocument && win.contentDocument.body.offsetHeight) 
                win.height = win.contentDocument.body.offsetHeight; 
                else if(win.Document && win.Document.body.scrollHeight)
                win.height = win.Document.body.scrollHeight;
            }
        }
    }