Chrome标准 | Chrome特殊 | IE标准 | IE特殊 | |
document.body.clientTop; | 0 | 0 | 0 | 2 |
document.body.clientLeft; | 0 | 0 | 0 | 2 |
document.body.clientWidth; | 473 | 473 | 471 | 471 |
document.body.clientHeight; | 2000 | 625 | 2000 | 604 |
document.body.scrollTop; | 224 | 289 | 0 | 255 |
document.body.scrollLeft; | 315 | 388 | 0 | 278 |
document.body.scrollWidth; | 2005 | 2005 | 2005 | 2010 |
document.body.scrollHeight; | 2010 | 2010 | 2000 | 2005 |
document.body.offsetTop; | 0 | 0 | 0 | 0 |
document.body.offsetLeft; | 0 | 0 | 0 | 0 |
document.body.offsetWidth; | 473 | 473 | 471 | 492 |
document.body.offsetHeight; | 2000 | 2000 | 2000 | 625 |
document.documentElement.clientTop; | 0 | 0 | 0 | 0 |
document.documentElement.clientLeft; | 0 | 0 | 0 | 0 |
document.documentElement.clientWidth; | 473 | 473 | 471 | 0 |
document.documentElement.clientHeight; | 625 | 2010 | 604 | 0 |
document.documentElement.scrollTop; | 0 | 0 | 199 | 0 |
document.documentElement.scrollLeft; | 0 | 0 | 241 | 0 |
document.documentElement.scrollWidth; | 2005 | 2005 | 2005 | 492 |
document.documentElement.scrollHeight; | 2010 | 2010 | 2010 | 625 |
document.documentElement.offsetTop; | 0 | 0 | 0 | 0 |
document.documentElement.offsetLeft; | 0 | 0 | 0 | 0 |
document.documentElement.offsetWidth; | 473 | 473 | 492 | 492 |
document.documentElement.offsetHeight; | 2010 | 2010 | 625 | 625 |
分析:
页面总宽度:document.body.scrollWidth;
页面总高度:document.body.scrollHeight;
Chrome页面位置:document.body.scrollTop; document.body.scrollLeft;
Chrome标准页面可视区域:document.documentElement.clientWidth; document.documentElement.clientHeight;
Chrome特殊页面可视区域:document.body.clientWidth; document.body.clientHeight;
IE标准页面位置:document.documentElement.scrollTop; document.documentElement.scrollLeft;
IE标准页面可视区域:document.documentElement.clientWidth; document.documentElement.clientHeight;
IE特殊页面位置:document.body.scrollTop; document.body.scrollLeft;
IE特殊页面可视区域:document.body.clientWidth; document.body.clientHeight;
JS代码如下: