<iframe name="ifrm" id="frm" src="yourPage.asp"><iframe>
<button onclick="frm.style.height=document.ifrm.document.body.clientHeight">
让iframe高度适应其内叶面高度</button>

解决方案 »

  1.   

    1.htm的代码:
    <iframe src=2.htm id=ifrm></iframe>2.htm的代码:
    <script>
    function resize()
    {parent.document.all.ifrm.height=document.body.scrollHeight;}
    </script>
    <body onload="resize()">
    </body>
      

  2.   

    补充,1.htm的代码最好改成:
    <iframe src=2.htm id=ifrm scrolling=no></iframe>
    这样,不要滚动条,也不会有内容溢出的情况了.
    最好在2.htm里面的高上面再加一个值(考虑边距),这样更保险!(不过不加也无所谓。)
      

  3.   

    <iframe name="ifrm" id="frm" src="yourPage.asp"><iframe>
    <button onclick="frm.style.height=document.ifrm.document.body.scrollTop">
    让iframe高度适应其内叶面高度</button>
    看看行不?
      

  4.   

    或者
    <iframe name="ifrm" id="frm" src="yourPage.asp"><iframe>
    <button onclick="frm.style.height=document.ifrm.document.body.scrollHeight">
    让iframe高度适应其内叶面高度</button>scrollHeight 表示网页正文全文高度,我像应该是对的
      

  5.   

    <iframe onload="this.height=this.document.body.scrollHeight;"></iframe>好像只有IE6支持,IE5没有iframe的onload事件