在被 iframe 包含的网页里加入如下代码: 
注意父网页的 iframe 的 name 不能为空!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 @*/
    var n = (document.body.style.overflow == "hidden") ? 0 : 16;
    e.height = parseInt(document.body.scrollHeight + n, 10);
  } 
}
window.attachEvent("onload", parentIframeHeight);

解决方案 »

  1.   

    window.attachEvent("onload", parentIframeHeight);
    这句应该加在哪个部位啊?请教~
      

  2.   

    <body onload="parentIframeHeight()">
      

  3.   

    以前写的,同时改变两个iframe的高度。
    这个是放在iframe页面中的//start changelength():改变iframe的长度,以便完全显示
    function changelength()
      {if (top.document.body.clientHeight<document.body.scrollHeight+2)
         {parent.right.height=document.body.scrollHeight+2;
          parent.left.height=document.body.scrollHeight+2;
         }
       else
         {parent.right.height=top.document.body.clientHeight;
          parent.left.height=top.document.body.clientHeight;
         }
       setTimeout("top.scrollTo(0,0)",1);
      }
    function window.onload()
      {changelength()
      }
    //end changelength()