JavaScript get scrollbar height + Common JS page width and heightJS (1)
/********************
* Take window scroll bar 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;
}
/********************
* Take the height of the window visible range
*******************/
function Getclientheight ()
{
var clientheight=0;
if (document.body.clientheight&&document.documentelement.clientheight)
{
var clientheight = (document.body.clientheight<document.documentelement.clientheight)? Document.body.clientHeight:document.documentElement.clientHeight;
}
Else
{
var clientheight = (document.body.clientheight>document.documentelement.clientheight)? Document.body.clientHeight:document.documentElement.clientHeight;
}
return clientheight;
}
/********************
* Take the actual height of the document content
*******************/
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 (i.e. body object width plus margin) Document.documentElement.clientHeight = = > Page object height (i.e. body object height plus margin)
Opera is:
Document.documentElement.clientWidth ==> Page object width (i.e. body object width plus margin) Document.documentElement.clientHeight = = > Page object height (i.e. body object height plus margin)
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