/* ******************* * Get window scrollbar height ******************/function getscrolltop () { var scrolltop=0; if (document.documentelement&&Document.documentElement.scrollTop) { scrolltop=document.documentElement.scrollTop; } Else if (document.body) { scrolltop=document.body.scrollTop; } return scrolltop;}
/******************** * Gets the height of the window's viewable range *******************/functiongetclientheight () {varClientheight=0; if(document.body.clientheight&&document.documentElement.clientHeight) {varClientHeight = (document.body.clientheight<document.documentelement.clientheight)?Document.body.clientHeight:document.documentElement.clientHeight; } Else { varClientHeight = (document.body.clientheight>document.documentelement.clientheight)?Document.body.clientHeight:document.documentElement.clientHeight; } returnclientheight;}
/* ******************* * Get document content actual height *******************/function getscrollheight () { return Math.max (document.body.scrollheight,document.documentelement.scrollheight );}
////////////////////////////////////////////////////
In ie:
document.body.clientWidth ==> Body Object width
document.body.clientHeight ==> 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.clientHeight ==> 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.clientHeight ==> Visible area height
document.documentElement.clientWidth ==> The width of the page object (that is, the body object width plus the margin width)
document.documentElement.clientHeight ==> Page object height (i.e. body object height plus margin height)
and if there is no standard to define the
IE is:
document.documentElement.clientWidth ==> 0
document.documentElement.clientHeight ==> 0
Firefox is:
document.documentElement.clientWidth ==> Page object width (that is, body object width plus margin) Document.documentElement.clientHeight = = height of the Page object (that is, the body object height plus the margin high)
Opera is:
document.documentElement.clientWidth ==> Page object width (that is, body object width plus margin) Document.documentElement.clientHeight = = height of the Page object (that is, the body object height plus the margin high)
really a troublesome thing, in fact, in terms of development, rather fewer objects and methods, do not use the latest standards to facilitate many AH.
//////////////////////////////////////////////////////////////////////////////////////
width of visible area of Web page:
Document.body.clientWidth
Web page Visible Area High:
Document.body.clientHeight
width of visible area of Web page:
Document.body.offsetWidth (including the width of the edge)
Web page Visible Area High:
Document.body.offsetHeight (including the width of the edge)
page Body Full text width:
Document.body.scrollWidth
page Body Full text High:
Document.body.scrollHeight
the page is rolled away High:
Document.body.scrollTop
webpage is rolled away left:
Document.body.scrollLeft
on the body part of the webpage:
Window.screentop
page body part left:
Window.screenleft
High screen resolution:
Window.screen.height
width of screen resolution:
Window.screen.width
screen usable workspace height:
Window.screen.availHeight
screen Usable workspace width:
Window.screen.availWidth
JavaScript get scrollbar height + Common JS page width and height (rpm)