<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-179  評論-666  文章-29  trackbacks-0


    var x = document.body.scrollLeft; 
    var y = document.body.scrollTop;

    //獲取屏幕寬度
       availWidth = parseInt(window.screen.availWidth);
       availHeight = parseInt(window.screen.availHeight);

    //獲取可見區域 寬度 高度
       availWidth = parseInt(document.body.clientWidth);
       availHeight = parseInt(document.body.clientHeight);
            
    可見區域高度:document.body.clientHeight
    總高度:document.body.scrollHeight
    可見區域寬度:document.body.clientWidth
    總寬度:document.body.scrollWidth

    ==============================================================

    var getWindowInfo=function()
    {
    var scrollX=0,scrollY=0,width=0,height=0,contentWidth=0,contentHeight=0;
    if(typeof(window.pageXOffset)=='number')
    {
     scrollX=window.pageXOffset;
     scrollY=window.pageYOffset;
    }
    else if(document.body&&(document.body.scrollLeft||document.body.scrollTop))
    {
     scrollX=document.body.scrollLeft;
     scrollY=document.body.scrollTop;
    }
    else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop))
    {
     scrollX=document.documentElement.scrollLeft;
     scrollY=document.documentElement.scrollTop;
    }

    if(typeof(window.innerWidth)=='number')
    {
     width=window.innerWidth;
     height=window.innerHeight;
    }
    else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))
    {
     width=document.documentElement.clientWidth;
     height=document.documentElement.clientHeight;
    }
    else if(document.body&&(document.body.clientWidth||document.body.clientHeight))
    {
     width=document.body.clientWidth;
     height=document.body.clientHeight;
    }

    if(document.documentElement&&(document.documentElement.scrollHeight||document.documentElement.offsetHeight))
    {
     if(document.documentElement.scrollHeight>document.documentElement.offsetHeight){
      contentWidth=document.documentElement.scrollWidth;
      contentHeight=document.documentElement.scrollHeight;
     }
     else
     {
      contentWidth=document.documentElement.offsetWidth;
      contentHeight=document.documentElement.offsetHeight;
     }
    }
    else if(document.body&&(document.body.scrollHeight||document.body.offsetHeight))
    {
     if(document.body.scrollHeight>document.body.offsetHeight)
     {
      contentWidth=document.body.scrollWidth;
      contentHeight=document.body.scrollHeight;
     }else{
      contentWidth=document.body.offsetWidth;
      contentHeight=document.body.offsetHeight;
     }
    }
    else
    {
     contentWidth=width;
     contentHeight=height;
    }
     if(height>contentHeight)
     height=contentHeight;
     if(width>contentWidth)
     width=contentWidth;
     var rect=new Object();
     rect.ScrollX=scrollX;
     rect.ScrollY=scrollY;
     rect.Width=width;
     rect.Height=height;
     rect.ContentWidth=contentWidth;
     rect.ContentHeight=contentHeight;
     return rect;
    }

    posted on 2007-05-25 13:34 Alpha 閱讀(9947) 評論(6)  編輯  收藏 所屬分類: JavaScript

    評論:
    # re: javascript 獲取窗口大小[未登錄] 2008-01-02 13:39 | aaa
    mark  回復  更多評論
      
    # re: javascript 獲取窗口大小 2008-07-03 10:50 | XU
    謝過~
    好東西啊。。。。。  回復  更多評論
      
    # re: javascript 獲取窗口大小 2009-07-20 11:37 | 周坤
    可以支持多瀏覽器,謝謝啦,呵呵。  回復  更多評論
      
    # re: javascript 獲取窗口大小[未登錄] 2010-09-02 13:57 | abc
    yes,henhao  回復  更多評論
      
    # re: javascript 獲取窗口大小[未登錄] 2010-11-10 15:57 | xx
    謝謝  回復  更多評論
      
    # re: javascript 獲取窗口大小 2012-04-22 16:40 | Joslin
    好東西啊!!!!!  回復  更多評論
      
    主站蜘蛛池模板: free哆啪啪免费永久| 国产精品偷伦视频观看免费 | 久久人午夜亚洲精品无码区| 亚洲视频免费在线看| 亚洲美女激情视频| 国产精品色拉拉免费看| 亚洲国产高清在线精品一区| 在线视频精品免费| 在线综合亚洲欧洲综合网站| 毛片高清视频在线看免费观看| 亚洲一卡一卡二新区无人区| 天天摸天天操免费播放小视频 | 国产精品亚洲专区一区| 国产在线19禁免费观看国产| 国产亚洲欧美日韩亚洲中文色| 国产精品冒白浆免费视频| 猫咪免费人成在线网站 | 免费看又爽又黄禁片视频1000| 色综合久久精品亚洲国产| 免费人成视频在线观看不卡| 一区二区免费电影| 亚洲AV无码成人精品区在线观看| 久久久久免费看成人影片| 亚洲xxxx18| 亚洲精品无码久久不卡| 成人性生交大片免费看好| 亚洲精品美女在线观看| 国产精品视_精品国产免费| 一级看片免费视频囗交| 亚洲AV日韩AV永久无码绿巨人| 57pao一国产成永久免费| 亚洲欧美综合精品成人导航| 红杏亚洲影院一区二区三区| 96免费精品视频在线观看| 亚洲伊人久久大香线蕉AV| 区三区激情福利综合中文字幕在线一区亚洲视频1 | 亚洲妇熟XXXX妇色黄| 69堂人成无码免费视频果冻传媒| 亚洲精品无码少妇30P| 亚洲女同成av人片在线观看 | 黑人粗长大战亚洲女2021国产精品成人免费视频|