Web pages are visible area width: document.body.clientWidth
The area of the webpage is high: document.body.clitingheight
Web pages are visible area width: document.body.OffsetWidth (including width of the edge)
The area of the webpage is high: document.body.Offsetheight (including the width of the edge)
Full text wide: document.body.scrollwidth
The full text of the webpage text high: document.body.scrollheight
The webpage is rolled high: document.body.scrolltop
The webpage is rolled on the left: document.body.scrollleft
Part of the webpage part: window.screentop
Webpage The text left: Window.screenleft
High screen resolution: window.screen.height
Width of the screen resolution: window.screen.width
Screen available working area height: window.screen.availheight
Screen available working area width: window.screen.availwidth
HTML precise position
scrollheight: Get the scroll height of the object.
ScrollLeft: Set or get the distance between the left end of the currently visible content in the left boundary and window of the object
Scrolltop: Set or get the distance between the top of the object and the top of the window in the window
scrollWidth: Get the scroll width of the object
Offsetheight: The height of the parent coordinates specified by the OFFSETParent attribute by the obtaining object
OffsetLeft: For the calculation left position of the patriarchal coordinate of the patriarchal coordinate specified by the OFFSETParent attribute
Offsettop: The top position of the calculation of the patriarchal coordinate of the pattern specified by the OFFSETTOP attribute
Event.clientX's horizontal coordinates of relative documents
Event.clienty's vertical coordinates of relative documents
Event.Offsetx Horizontal coordinates of relative containers
Event.Offsety's vertical coordinates
document.documenetElement.scrolltop Valted Valley Rolling Valley
Event.clientX+Document.documentelement.scrolltop The horizontal seat label of the relative document+the amount of rolling vertical rolling
IE, Firefox differences are as follows:
IE6.0, FF1.06+:
ClientWidth = Width + Padding
clientheight = height + padding
OffsetWidth = Width + Padding + Border
Offsetheight = Height + Padding + Border
IE5.0/5.5:
clientWidth = width -border
clientheight = Height -Border
Offsetwidth = width
Offsetheight = Height
(Need to mention: the Margin attributes in CSS are not related to ClientWidth, OffsetWidth, Clientheight, OfficeTheight)
=========================================== ===
Yesterday, I replaced some pages in the project. After the replacement was replaced, I found that some JS was difficult to use. The width obtained by the page width obtained by sentences such as document.documenetElement.clientWidth is 0. After some Google, I realized that it was the lack of references to the W3C standard on the new page, resulting in the document.documentedlement.clientWidth failure:
<! Doctype HTML PUBLIC "-// W3C // DTD XHTML 1.0 Transitional // EN" http://www.w3.org/xhtml1/dtddml1-transitationAl.dtd ">
If you add this line to the page
In IE:
document.body.clientWidth ==> Body object width
document.body.clitingheight ==> Body object height
document.documentelement.clientWidth ==> Visible area width
document.documentelement.clientHeight ==> Visible area height
In Firefox :
document.body.clientWidth ==> Body object width
document.body.clitingheight ==> Body object height
document.documentelement.clientWidth ==> Visible area width
document.documentelement.clientHeight ==> Visible area height
In Opera:
document.body.clientWidth ==> Visible area width
document.body.clitingheight ==> Visible area height
document.documentelement.clientWidth ==> page object width (ie, the width of the Body object plus Margin width)
document.documentelement.clientheight ==>> Page Object height (that is, the height of the Body object plus Margin high)
And if there is no standard definition of W3C, then
IE is:
document.documentelement.clientWidth ==> 0
document.documentelement.clientheight ==> 0
Firefox is:
document.documentelement.clientWidth ==> page Object width (ie, the width of the body object plus margin width) document.documenetElement.clientheight ==> page Face object height (that is, the height of the BODY object plus Margin high)
Opera is:
document.documentelement.clientWidth ==> page Object width (ie, the width of the body object plus margin width) document.documenetElement.clientheight ==> page Face object height (that is, the height of the BODY object plus Margin high)