(document.documentElement.scrollTop != 0 ? document.documentElement.scrollTop : document.body.scrollTop)
都换成三元呢?

解决方案 »

  1.   

    看看你的代码中有没有
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">如果没有可能会不正确。
      

  2.   

    如果你加了dtd就用document.documentElement如果没加就用document.body
    如果情况很复杂(有的加了有的没加)你就用三元或者var height = document.compatMode=="CSS1Compat" ? document.documentElement.clientHeight : document.body.clientHeight;
    这样判断。。