How to obtain the area size of the browser page is as follows:
The Code is as follows:
// Available in IE, FireFox, and Opera
Document. body. clientWidth
Document. body. clientHeight
// It can be obtained, which is very simple and convenient.
// In the company project:
// 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.
// Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
// If this line is added to the page
// In 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)