A little research on obtaining the visible window size of various browsers
<SCRIPT>
Function getinfo ()
{
VaR S = "";
S = "visible area width of the webpage:" document. Body. clientwidth;
S = "visible area of the webpage:" document. Body. clientheight;
S = "visible area width of the webpage:" document. Body. offsetwidth "(including the width of the edge and the scroll bar )";
S = "visible area height of the webpage:" document. Body. offsetheight "(including the width of the edge )";
S = "webpage body full text width:" document. Body. scrollwidth;
S = "webpage text Height:" document. Body. scrollheight;
S = "page size (FF):" document. Body. scrolltop;
S = "webpage volume high (IE):" document.doc umentelement. scrolltop;
S = "Left of the webpage volume:" document. Body. scrollleft;
S = "Page body part:" window. screentop;
S = "webpage body part left:" window. screenleft;
S = "Screen Resolution Height:" window. Screen. height;
S = "Screen Resolution width:" window. Screen. width;
S = "screen available workspace Height:" window. Screen. availheight;
S = "available screen workspace width:" window. Screen. availwidth;
S = "your screen is set to" window. Screen. colordepth "color ";
S = "Your Screen Settings" window. Screen. devicexdpi "pixels/inches ";
// Alert (s );
}
Getinfo ();
</SCRIPT>
In my local test:
It can be used in IE, Firefox, and opera
Document. Body. clientwidth
Document. Body. clientheight
It is very simple and convenient.
In the company's projects:
Opera is still in use
Document. Body. clientwidth
Document. Body. clientheight
However, ie and Firefox use
Document.doc umentelement. clientwidth
Document.doc umentelement. clientheight
It turned out to be W3C standards.
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
If you add this line of tag to the page, you can add it to IE:
Document. Body. clientwidth ==> body object width
Document. Body. clientheight ==> body object height
Document.doc umentelement. clientwidth ==> visible area width
Document.doc umentelement. clientheight => visible area height
In Firefox:
Document. Body. clientwidth ==> body object width
Document. Body. clientheight ==> body object height
Document.doc umentelement. clientwidth ==> visible area width
Document.doc umentelement. clientheight => visible area height
?
In opera:
Document. Body. clientwidth ==> visible area width
Document. Body. clientheight ==> visible area height
Document.doc umentelement. clientwidth ==> Page Object width (that is, the width of the body object plus the margin width)
Document.doc umentelement. clientheight ==> Page Object height (that is, the height of the body object plus the margin height)
If W3C standards are not defined
IE:
Document.doc umentelement. clientwidth ==> 0
Document.doc umentelement. clientheight => 0
Firefox:
Document.doc umentelement. clientwidth ==> Page Object width (that is, adding the bodyobject width to the marginwidth) document.doc umentelement. clientheight ==> Page Object height (that is, the body object height plus the margin height)
Opera:
Document.doc umentelement. clientwidth ==> Page Object width (that is, adding the bodyobject width to the marginwidth) document.doc umentelement. clientheight ==> Page Object height (that is, the body object height plus the margin height)