alert(window.document.body.clientWidth);
alert(window.document.body.clientHeight);

解决方案 »

  1.   

    <body ondblclick="alert(this.clientWidth +','+ this.clientHeight);">
    双击看看
    </body>
      

  2.   

    没有错,但网页中要有<body></body>标签
      

  3.   

    谢谢大家
    再麻烦大家帮我看看我这种情况该怎么写,我用的是框架,没有<body>
    <html>
      <head>
        <meta http-equiv=Content-Language content=zh-cn>
        <meta http-equiv=Content-Type content='text/html;charset=GB2312'>
        <meta http-equiv='imagetoolbar' content='no'>    <object id=maximize type='application/x-oleobject' classid='clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11'>
          <param name='Command' value='MAXIMIZE'>
        </object>    <script language=javascript>
          if(self!=top)top.location=self.location;            //如果在其他框架内则解除框架
          var width=window.document.body.clientWidth;         //窗口宽  ,就这里出错
          var height=window.document.body.clientHeight;       //窗口高
          if(width<screen.width || height<screen.height)maximize.Click(); //如果窗口不是最大化,则使其最大化
        </script>
        
        <title>测试</title>
      </head>  <frameset rows='5%,*'>
        <frame src='top.php' name='top'>
        <frameset cols='20%,*' name='Menu'>
          <frame src=left.php name='Left'>
          <frame src='main.php' name='Main'>
        </frameset>
      </frameset>  <body>
        <noframes>你的浏览器不支持框架</noframes>
      </body>
    </html>我的目的是不是判断当前窗口是不是最大化了,我是用当前窗口的宽高与屏幕的宽高来比较
    或者有没有其他方法来判断呢?