index.html的代码如下:
<iframe src="a.html"></iframe>a.html的代码如下:
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<frameset rows="30,*"  cols="*" frameborder="NO" border="0" framespacing="0" id="frame1">
<frame name="top" scrolling="no" noresize src="top.html" frameborder="0">
<frame name="main" scrolling="auto" noresize src="main.html" frameborder="0">
</frameset><noframes></noframes>
</html>问题:
我如何让inde.html里的页面中的<iframe src="a.html"></iframe>中高度 自动适应main.html页面的高度呢?等到高人赐教~~谢谢

解决方案 »

  1.   

    <iframe id="frame_content" src="iframe_b.html" scrolling="no" frameborder="0" onload="this.height=100"></iframe>
        <script type="text/javascript">
        function reinitIframe(){
        var iframe = document.getElementById("frame_content");
        try{
        var bHeight = iframe.contentWindow.document.body.scrollHeight;
        var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
        var height = Math.max(bHeight, dHeight);
        iframe.height =  height;
        }catch (ex){}
        }
        window.setInterval("reinitIframe()", 200);
        </script>
      

  2.   

    楼上的代码 只对iframe_b.html 页面为普通页面采用用哦 如果iframe_b.html  页面内容为<frameset rows="30,*" cols="*" frameborder="NO" border="0" framespacing="0" id="frame1">
    框架页面 就不行了