对于所有的浏览器
只有对document.body.clientHeight的高度解释是一样的
所以可以用clientHeight属性
不要用offsetHeight
__________________
但是使用clientHeight前
请加入对body高度的定义
<style type="css/text">
 body,hrml {
  height:100%;
 }
</style>

解决方案 »

  1.   

    顺便问一下
    “梅花xie”是什么意思?
    谢谢!
      

  2.   

    function iframeAutoFit()
       {
          try
          {
             if(window!=parent)
             {
              var a = parent.document.getElementsByTagName("IFRAME");
                for(var i=0; i<a.length; i++) //author:meizz
                {
                   if(a[i].contentWindow==window)
                   {
                       var h = document.body.scrollHeight;
                       if(document.all) {h += 4;}
                       if(window.opera) {h += 1;}
                       a[i].style.height = h;
                   }
                }
             }
          }
          catch (ex)
          {
             alert("脚本无法跨域操作!");
          }
       }
       if(document.attachEvent)  window.attachEvent("onload",  iframeAutoFit);  
       else  window.addEventListener('load',  iframeAutoFit,  false);  
    这个就是目前我为CSDN论坛网页写的网页高度自适应代码,在IE7下面表现正常呀。(不过这段代码只适用于IE和Opera