광산은 다음과 같습니다. <! doctype html>
블로그 파크 : <! doctype html public- // w3c // dtd html 4.01 Transitional // en>
html 문서 유형 참조 소개 : http://i.wanz.im/2010/05/28/why_doctype_html/
JS가 현재 페이지의 시각적 크기를 확인하고 찾는지 확인하고 페이지의 스크롤 위치와 다릅니다!
이 페이지에는 2000*2000 div가 포함되어 있으며, 이는 다른 HTML 문서 유형의 IE 및 Chrome이 포함되어 있습니다.
표준 : <! doctype html>
특별 : <! doctype html public- // w3c // dtd html 4.01 Transitional // en>
HTML 문서 유형이 HTML에 추가되지 않으면 기본값은 특수 모드입니다!
| 크롬 표준 | 크롬 스페셜 | 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;
크롬 페이지 위치 : 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 코드는 다음과 같습니다.코드를 복사하십시오