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 >
          輸出結(jié)果如下:
          瀏覽器窗口實際寬度: 858
          瀏覽器窗口實際高度: 598
          posted on 2007-03-11 12:57 阿蜜果 閱讀(1272) 評論(1)  編輯  收藏 所屬分類: 芝麻粒知識


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

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

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

          留言簿(263)

          隨筆分類

          隨筆檔案

          文章分類

          相冊

          關(guān)注blog

          積分與排名

          • 積分 - 2296322
          • 排名 - 3

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 鄂托克旗| 乐亭县| 临潭县| 吐鲁番市| 确山县| 韶山市| 双柏县| 孟津县| 子长县| 肃北| 高淳县| 古丈县| 马尔康县| 望都县| 秦皇岛市| 平顺县| 丹东市| 石林| 错那县| 临清市| 乐安县| 灵丘县| 赤水市| 东光县| 仲巴县| 佳木斯市| 曲松县| 井冈山市| 伊通| 霞浦县| 犍为县| 乌审旗| 微山县| 马山县| 和政县| 喀喇| 扶余县| 富阳市| 温州市| 乐安县| 莲花县|