元素和页面差不多,至于什么是什么,自己试试搜索百度,GOOGLE,反正你都要了解他们了。获取页面高度,窗口高度,滚动条高度等参数值function getPageScroll(){
  var yScroll;
  if (self.pageYOffset) {
    yScroll = self.pageYOffset;
  } else if (document.documentElement && document.documentElement.scrollTop){   // Explorer 6 Strict
    yScroll = document.documentElement.scrollTop;
  } else if (document.body) {// all other Explorers
    yScroll = document.body.scrollTop;
  }  arrayPageScroll = new Array('',yScroll) 
  return arrayPageScroll;
}function getPageSize(){  
  var xScroll, yScroll;  
  if (window.innerHeight && window.scrollMaxY) {  
    xScroll = document.body.scrollWidth;
    yScroll = window.innerHeight + window.scrollMaxY;
  } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
    xScroll = document.body.scrollWidth;
    yScroll = document.body.scrollHeight;
  } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
    xScroll = document.body.offsetWidth;
    yScroll = document.body.offsetHeight;
  }  var windowWidth, windowHeight;
  if (self.innerHeight) {  // all except Explorer
    windowWidth = self.innerWidth;
    windowHeight = self.innerHeight;
  } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
    windowWidth = document.documentElement.clientWidth;
    windowHeight = document.documentElement.clientHeight;
  } else if (document.body) { // other Explorers
    windowWidth = document.body.clientWidth;
    windowHeight = document.body.clientHeight;
  }  
  
  // for small pages with total height less then height of the viewport
  if(yScroll < windowHeight){
    pageHeight = windowHeight;
  } else { 
    pageHeight = yScroll;
  }  if(xScroll < windowWidth){  
    pageWidth = windowWidth;
  } else {
    pageWidth = xScroll;
  }  arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
  return arrayPageSize;
}

document.body.scrollTop无效的解决方法当网站做了以下声明时,发现网站上的对联广告无效,其实是document.body.scrollTop无效果了。当网页做了以下声明时<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     原因是声明后document.body.scrollTop的值永远等于0,解决办法是只需把document.body用document.documentElement替换即可。

解决方案 »

  1.   

    s  =  "网页可见区域宽:"+  document.body.clientWidth;  
    s  +=  "\r\n网页可见区域高:"+  document.body.clientHeight;  
    s  +=  "\r\n网页可见区域宽:"+  document.body.offsetWidth  +"  (包括边线的宽)"; 
    s  +=  "\r\n网页可见区域高:"+  document.body.offsetHeight  +"  (包括边线的高)"; 
    s  +=  "\r\n网页正文全文宽:"+  document.body.scrollWidth;  
    s  +=  "\r\n网页正文全文高:"+  document.body.scrollHeight;  
    s  +=  "\r\n网页被卷去的高:"+  document.body.scrollTop;  
    s  +=  "\r\n网页被卷去的左:"+  document.body.scrollLeft;  
    s  +=  "\r\n网页正文部分上:"+  window.screenTop;  
    s  +=  "\r\n网页正文部分左:"+  window.screenLeft;  
    s  +=  "\r\n屏幕分辨率的高:"+  window.screen.height;  
    s  +=  "\r\n屏幕分辨率的宽:"+  window.screen.width;  
    s  +=  "\r\n屏幕可用工作区高度:"+  window.screen.availHeight;  
    s  +=  "\r\n屏幕可用工作区宽度:"+  window.screen.availWidth;