Mine is: <!DOCTYPE html>
Blog Park: <!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN>
About HTML document type reference: http://i.wanz.im/2010/05/28/why_doctype_html/
Checking and finding that JS is getting the visual size of the current page, which is different from the scrolling position of the page!
The page contains a 2000*2000 DIV which is IE and Chrome in different HTML document types tested and sorted data as follows:
Standard: <!DOCTYPE html>
Special: <!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN>
When HTML document type is not added to HTML, the default is special mode!
| Chrome Standard | Chrome Special | IE Standard | IE Special | |
| 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 |
Total page width: document.body.scrollWidth;
Total page height: document.body.scrollHeight;
Chrome page location: document.body.scrollTop; document.body.scrollLeft;
Chrome standard page visual area: document.documentElement.clientWidth; document.documentElement.clientHeight;
Chrome special page visual area: document.body.clientWidth; document.body.clientHeight;
IE standard page location: document.documentElement.scrollTop; document.documentElement.scrollLeft;
The visual area of the IE standard page: document.documentElement.clientWidth; document.documentElement.clientHeight;
IE special page location: document.body.scrollTop; document.body.scrollLeft;
IE special page visual area: document.body.clientWidth; document.body.clientHeight;
The JS code is as follows:Copy the code