posts - 297,  comments - 1618,  trackbacks - 0
          < html >
          ????
          < head >
          ????????
          < title > 獲取瀏覽器窗口的大小 </ title >
          ????
          </ head >
          ????
          < body >
          ????????
          < script? type ="text/javascript" >
          ????????
          <!--
          ????????????
          var ?winWidth? = ? 0 ;
          ????????????
          var ?winHeight? = ? 0 ;
          ????????????
          // 獲得窗口寬度
          ???????????? if (window.innerWidth)? {
          ????????????????document.write(
          " innerWidth<br> " );
          ????????????????winWidth?
          = ?window.innerWidth;
          ????????????}
          ? else ? if ((document.body)? && ?(document.body.clientWidth))? {
          ????????????????winWidth?
          = ?document.body.clientWidth;
          ????????????}


          ????????????
          // 獲得窗口高度
          ???????????? if (window.innerHeight)? {
          ????????????????document.write(
          " innerHeight<br> " );
          ????????????????winHeight?
          = ?window.innerHeight;
          ????????????}
          ? else ? if ((document.body)? && ?(document.body.clientHeight))? {
          ????????????????winHeight?
          = ?document.body.clientHeight;
          ????????????}


          ????????????
          if (document.documnetElement? && ?document.documnetElement.clientHeight? && ?document.documnetElement.clientWidth)? {
          ????????????????alert(
          " documnetElement<br> " );
          ????????????????winWidth?
          = ?document.documnetElement.clientWidth;
          ????????????????winHeight?
          = ?document.documnetElement.clientHeight;
          ????????????}


          ????????????document.write(
          " 瀏覽器窗口實際寬度:? " ? + ?winWidth? + ? " <br> " );
          ????????????document.write(
          " 瀏覽器窗口實際高度:? " ? + ?winHeight);
          ????????
          // -->
          ????????
          </ script >
          ????
          </ body >
          </ html >
          輸出結果如下:
          瀏覽器窗口實際寬度: 858
          瀏覽器窗口實際高度: 598
          posted on 2007-03-11 12:57 阿蜜果 閱讀(1272) 評論(1)  編輯  收藏 所屬分類: 芝麻粒知識


          FeedBack:
          # re: 獲取瀏覽器窗口的大小
          2007-04-11 14:08 | @#$%
          我很想知道
          你怎么實現的這種樣式
          也下了源碼看看了一下,
          不過發現好麻煩啊,
          做出這種效果真的需要這么麻煩嗎
          還是你有什么訣竅
            回復  更多評論
            
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

                生活將我們磨圓,是為了讓我們滾得更遠——“圓”來如此。
                我的作品:
                玩轉Axure RP  (2015年12月出版)
                

                Power Designer系統分析與建模實戰  (2015年7月出版)
                
               Struts2+Hibernate3+Spring2   (2010年5月出版)
               

          留言簿(263)

          隨筆分類

          隨筆檔案

          文章分類

          相冊

          關注blog

          積分與排名

          • 積分 - 2296369
          • 排名 - 3

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 晋城| 泌阳县| 阜南县| 水城县| 台中市| 盐源县| 库尔勒市| 阿克| 大新县| 读书| 桓台县| 竹北市| 连云港市| 宣恩县| 名山县| 高邮市| 四会市| 阿克苏市| 隆化县| 井陉县| 阜平县| 台南县| 泽普县| 高雄市| 武隆县| 方城县| 汕尾市| 栖霞市| 峨山| 佛冈县| 交口县| 万盛区| 红安县| 泾川县| 正阳县| 黔西县| 宁河县| 陆河县| 剑川县| 曲麻莱县| 兴化市|