QQ邮箱中,获取页面高度或宽度的Js函数

  <script type="text/javascript">

    var getScreen = function (name) {

      var elem = document;

      return Math.max( elem.documentElement["client" + name], elem.body["scroll" + name], elem.documentElement["scroll" + name], elem.body["offset" + name], elem.documentElement["offset" + name] ) ;

    }

    var gIsSmall = false;

    alert(getScreen('Width')) ;

           alert(getScreen('Height')) ;

  </script>

你可能感兴趣的:(js)