Get the size of the browser page area:
//In IE , FireFox and Opera can use
document.body.clientWidth
document.body.clientHeight
// to get it, very simple and convenient.
//In company projects:
//Opera still uses
document.body.clientWidth
document.body.clientHeight
//But IE and FireFox use
document .documentElement.clientWidth
document.documentElement.clientHeight
//It turns out that the W3C standard is causing trouble
//http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional. dtd”>
//If you add this line of tags to the page
//In IE:
document.body.clientWidth ==> BODY object width
document. body.clientHeight ==> BODY object height
document.documentElement.clientWidth ==> 🎜>document.body.clientWidth ==> BODY object width
document.body.clientHeight ==>gt; 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 ==> Page object width (that is, BODY object width plus Margin width)
document.documentElement.clientHeight ==>gt; Page object height (that is, BODY object height plus Margin width) High)
//If there is no W3C standard defined, then
//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 width) document.documentElement.clientHeight ==>; Page object height (i.e., BODY object height) Plus Margin height)
//Opera is:
document.documentElement.clientWidth ==> page object width (that is, BODY object width plus Margin width) document.documentElement.clientHeight ==> page object height (That is, the height of the BODY object plus the height of the Margin)