针对 iframe 的自适应高度我写了一个函数, 你自己再发挥一下吧(此代码放在iframe里):function parentIframeHeight()
{
  if(top!=self && self.name!="")
  {
    var e;
    /*@cc_on @*/ /*@if (@_jscript_version>=3) e = window.parent.document.all(self.name); @else @*/
      if(window.navigator.appName=="Netscape" && parseInt(window.navigator.appVersion)>5)
        e = window.parent.document.getElementById(self.name);
      else e = eval("window.parent."+ self.name);
    /*@end @*/
    e.height = parseInt(document.body.scrollHeight, 10);
  } 
}

解决方案 »

  1.   

    test.htm<body> 
    <iframe id="iframeID" height='100' src="1.htm"></iframe> 
    1.htm <body onload="parent.window.document.all.iframeID.height=document.all.bd.clientHeight + 40"> 
    <table id=bd> 
    <tr> 
    <td> 
    <p>灰豆宝宝.net<p>灰豆宝宝.net<p>灰豆宝宝.net<p>灰豆宝宝.net<p>灰豆宝宝.net
    <p>灰豆宝宝.net<p>灰豆宝宝.net<p>灰豆宝宝.net<p>灰豆宝宝.net<p>灰豆宝宝.net</td> 
    </tr> 
    </table>
      

  2.   

    我也有这个问题。
    请问meizz:
      这段代码放在iframe嵌的那张页面里吗?
      

  3.   

    <iframe src='http://www.csdn.net'  
            NAME='PICC_CoverInfo'
            ID='PICC_CoverInfo'
            FRAMEBORDER=0        
            marginWidth="0"
            marginHeight="0"
            scrolling=no
            width="100%"
            onload='var f=document.all["PICC_CoverInfo"]; var b=f.Document.body; f.height=b.scrollHeight'> 
    </iframe>