Home  >  Article  >  Web Front-end  >  ff Similarities and differences between global dynamic positioning under chrome and ie and how to obtain global height_javascript skills

ff Similarities and differences between global dynamic positioning under chrome and ie and how to obtain global height_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:42:391101browse

DTD declared

IE
document.documentElement.scrollHeight is the height of all content in the browser, document.body.scrollHeight is the height of all content in the browser
document.documentElement.scrollTop The height of the browser scrolling part, document.body.scrollTop is always 0
document.documentElement.clientHeight is the height of the visible part of the browser, document.body.clientHeight is the height of all content in the browser

FF
document.documentElement.scrollHeight is the height of all content in the browser, document.body.scrollHeight is the height of all content in the browser
document.documentElement.scrollTop The height of the browser scrolling part, document.body.scrollTop is always 0
document.documentElement.clientHeight is the height of the visible part of the browser, document.body.clientHeight is the height of all content in the browser

Chrome
document.documentElement.scrollHeight is the height of all content in the browser, document.body.scrollHeight is the height of all content in the browser
document.documentElement.scrollTop is always 0, document.body.scrollTop is the height of the browser scrolling part
document.documentElement.clientHeight is the height of the visible part of the browser, document.body.clientHeight is the height of all content in the browser

DTD not declared

IE
document.documentElement.scrollHeight is the height of the visible part of the browser, document.body.scrollHeight is the height of all content in the browser
document.documentElement.scrollTop is always 0, document.body.scrollTop is the height of the browser scrolling part
document.documentElement.clientHeight is always 0, document.body.clientHeight is the height of the visible part of the browser

FF
document.documentElement.scrollHeight is the height of the visible part of the browser, document.body.scrollHeight is the height of all content in the browser
document.documentElement.scrollTop is always 0, document.body.scrollTop is the height of the browser scrolling part
document.documentElement.clientHeight is the height of all content in the browser, document.body.clientHeight is the height of the visible part of the browser

Chrome
document.documentElement.scrollHeight is the height of the visible part of the browser, document.body.scrollHeight is the height of all content in the browser
document.documentElement.scrollTop is always 0, document.body.scrollTop is the height of the browser scrolling part
document.documentElement.clientHeight is the height of all content in the browser, document.body.clientHeight is the height of the visible part of the browser

The height of all content in the browser is the height of the entire frame of the browser, including the sum of the heights of the part where the scroll bar is rolled out, the visible part, and the hidden part at the bottom

The height of the scrolled part of the browser is the height of the scroll bar, which is the height of the visual top from the top of the entire object.

DTD declaration refers to the declaration when the browser page is loaded:

Declare document type html

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn