网页可见区域宽:document.body.clientWidth
网页可见区域高:document.body.clientHeight
网页可见区域宽:document.body.offsetWidth (包括边线的宽)
网页可见区域高:document.body.offsetHeight (包括边线的宽)
网页正文全文宽:document.body.scrollWidth
网页正文全文高:document.body.scrollHeight
网页被卷去的高:document.body.scrollTop
网页被卷去的左:document.body.scrollLeft
网页正文部分上:window.screenTop
网页正文部分左:window.screenLeft
屏幕分辨率的高:window.screen.height
屏幕分辨率的宽:window.screen.width
屏幕可用工作区高度:window.screen.availHeight
屏幕可用工作区宽度:window.screen.availWidth---------------------------------------------这些都是不是我想要的值,我是想获取浏览器窗口 去掉上面的工具栏、下面的状态栏、以及右面的滚动条(可能还有左面的工具区域)剩下的那部分另外还有个问题,当这个区域的大小发生改变时怎样触发事件?

解决方案 »

  1.   

    那不就是屏幕的宽和高吗? 是onresize事件吧
      

  2.   

    http://blog.csdn.net/natineprince/archive/2009/04/30/4138260.aspxonresize事件.
      

  3.   

    不就是 document.body.scrollHeight  么?
      

  4.   

    散分了,自己解决了,现在CSDN怎么总没好的回答了呢我是为了控制iframe的高度,让它自适应窗口大小,上左右这样的没法控制下面的框架高度。
    另外有点击可隐藏的面板,点面板后,高度也自动适应,填充
    <script language="javascript">
    var winWidth=0; //窗口宽
    var winHeight=0; //窗口高
    var topHeight=120+9; //标题栏高度+控制栏高度function findDimensions(){ //获取窗口大小
    //获取窗口宽度
    if (window.innerWidth)
         winWidth = window.innerWidth;
    else if ((document.body) && (document.body.clientWidth))
         winWidth = document.body.clientWidth;
    //获取窗口高度
    if (window.innerHeight)
         winHeight = window.innerHeight;
    else if ((document.body) && (document.body.clientHeight))
         winHeight = document.body.clientHeight;
    //通过深入Document内部对body进行检测,获取窗口大小
    if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth){
         winHeight = document.documentElement.clientHeight;
         winWidth = document.documentElement.clientWidth;
        }
    }function switchtop(){ //收缩标题栏
    if (rolltop.innerText==5){
       rolltop.innerText=6;
       document.all("tdtop_frame").style.height=28;
       tdtop_roll.title="展开标题栏";
       topHeight=28+9;
       resize();
    }
    else{
       rolltop.innerText=5;
       document.all("tdtop_frame").style.height=120;
       tdtop_roll.title="收缩标题栏";
       topHeight=120+9;
       resize();
    }
    }function switchleft(){ //收缩控制面板
    if (rollleft.innerText==3){
       rollleft.innerText=4;
       document.all("tdleft_frame").style.display="none";
       tdleft_roll.title="展开控制面板";
    }
    else{
       rollleft.innerText=3;
       document.all("tdleft_frame").style.display="";
       tdleft_roll.title="隐藏控制面板";
    }
    }function resize(){ //更改底部框架高度
    findDimensions();
    document.all("tdleft").style.height=winHeight-topHeight;
    document.all("tdleft_frame").style.height=winHeight-topHeight;
    document.all("tdmain").style.height=winHeight-topHeight;
    document.all("tdmain_frame").style.height=winHeight-topHeight;
    }</script>