window的 innerWidth innerHeight 和outerWidth outerHeight 是乎都不能直接获取

解决方案 »

  1.   

    可以,在firebug控制台输入window.innerWidth显示下面的结果
    >>> window.innerWidth 
    1366
      

  2.   

    输出的结果为“没有获取到浏览器宽度”,这是为什么呢
    <html>
    <head>
    <title></title>
    </head>
    <body>
    你可以
    <script type="text/javascript"> 
    if(window.innerWidth){
    alert("浏览器宽度为:" + window.innerWidth);
    }else{
    alert("没有获取到浏览器宽度!");
    }
    </script>
    </body>
    </html>
      

  3.   

    楼主
    window 对象的一些属性或方法 在各个浏览器下 兼容不友好可以使用
    Screen 对象包含有关客户端显示屏幕的信息
    参考
    http://www.w3school.com.cn/htmldom/prop_win_innerheight_innerwidth.asp