The scrollheight/scrolltop/clientheight of Document.documentelement and Document.body under Ie/ff/chrome

Source: Internet
Author: User

DTD has been declared
Ie
Document.documentElement.scrollHeight Browser All content height, document.body.scrollHeight browser all content height
Document.documentElement.scrollTop Browser Scroll section height, Document.body.scrollTop always 0
Document.documentElement.clientHeight Browser viewable section height, document.body.clientHeight browser all content height


Ff
Document.documentElement.scrollHeight Browser All content height, document.body.scrollHeight browser all content height
Document.documentElement.scrollTop Browser Scroll section height, Document.body.scrollTop always 0
Document.documentElement.clientHeight Browser viewable section height, document.body.clientHeight browser all content height


Chrome
Document.documentElement.scrollHeight Browser All content height, document.body.scrollHeight browser all content height
Document.documentElement.scrollTop always scrolls part height for 0,document.body.scrolltop browser
Document.documentElement.clientHeight Browser viewable section height, document.body.clientHeight browser all content height


DTD not declared
Ie
Document.documentElement.scrollHeight Browser viewable section height, document.body.scrollHeight browser all content height
Document.documentElement.scrollTop always scrolls part height for 0,document.body.scrolltop browser
Document.documentElement.clientHeight always viewable part height for 0,document.body.clientheight browser


Ff
Document.documentElement.scrollHeight Browser viewable section height, document.body.scrollHeight browser all content height
Document.documentElement.scrollTop always scrolls part height for 0,document.body.scrolltop browser
Document.documentElement.clientHeight Browser All content height, document.body.clientHeight browser viewable part height


Chrome
Document.documentElement.scrollHeight Browser viewable section height, document.body.scrollHeight browser all content height
Document.documentElement.scrollTop always scrolls part height for 0,document.body.scrolltop browser
Document.documentElement.clientHeight Browser All content height, document.body.clientHeight browser viewable part height

Browser All content height that is the height of the entire frame of the browser, including the scroll strip volume go to part + visible part + bottom hidden section height sum

The browser scrolls the height of the scroll bar, which is the height of the top of the entire object, depending on the height.


In comprehensive

1, Document.documentElement.scrollTop and Document.body.scrollTop always have a 0, so you can use these two and to seek scrolltop

2, ScrollHeight, clientheight in the case of a DTD has been declared with the documentelement, not declared the case with the body

Document.compatmode can be used to determine if a DTD is declared with a value of "Backcompat": not declared with a value of "Css1compat"

The scrollheight/scrolltop/clientheight of Document.documentelement and Document.body under Ie/ff/chrome

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.