<iframe id="iframe" runat="server" src="/Page.aspx" width="100%" frameborder="0" scrolling="yes" ></iframe> 这是我用的框架但是,我有一个问题,怎么样能让框架的高度变为自动的请教高手这先谢过

解决方案 »

  1.   

    hight="",跟你的width属性一样!只是你没有写hight
      

  2.   

    写一段JS: 
    <script type="text/javascript">
        function autoHeight()
        {
            var obj=window.frames["right"];
            document.getElementById("right").height=obj.document.body.scrollHeight+20;
        }
        </script>
    <iframe id="right" name="right" onload="autoHeight()"></iframe>
      

  3.   

    <iframe id="iframe" runat="server" src="/Page.aspx" width="100%" frameborder="0" scrolling="yes" onload="this.height=iframe.document.body.scrollHeight; if (this.height<470) this.height=470;"> </iframe> 
    首先要给一个高度的,这样做可以根据高度的变化,自动调整高度
      

  4.   

    4楼的   应输入标识符,“this”是关键字<iframe id="iframe" name="iframe" runat="server" src="/Page.aspx" width="100%" frameborder="0" scrolling="yes" onload="this.height=iframe.document.body.scrollHeight; if (this.height <470) this.height=470;"></iframe> 
                        
      

  5.   

    2楼的 你的 找不到 onload="autoHeight()"
      

  6.   

    框架根据页面大小自动调整
       <iframe id="myframe" src="#" frameborder=0 width="100%" height="500px" scrolling=no onload="SetWinHeight(this)" style="border-bottom:0px; border=0px"></iframe>
    <script>
    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;
                }
               }
    }
    </script>