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 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) The W3C standard is 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) Visible area width of the webpage: Document. Body. clientwidth Visible area height: Document. Body. clientheight Visible area width of the webpage: Document. Body. offsetwidth (including the width of the edge) Visible area height of the webpage: Document. Body. offsetheight (including the height of the edge) Webpage text width: Document. Body. scrollwidth Webpage text height: Document. Body. scrollheight The height of the page to be rolled: Document. Body. scrolltop Left: Document. Body. scrollleft Page body: window. screentop Page body part left: window. screenleft Screen Resolution Height: window. Screen. Height Screen Resolution width: window. Screen. Width Available screen workspace Height: window. Screen. availheight Available workspace width: window. Screen. availwidth Visible area width of the webpage: Document. Body. clientwidth Visible area height: Document. Body. clientheight Visible area width of the webpage: Document. Body. offsetwidth (including the width of the edge) Visible area height of the webpage: Document. Body. offsetheight (including the height of the edge) Webpage text width: Document. Body. scrollwidth Webpage text height: Document. Body. scrollheight The height of the page to be rolled: Document. Body. scrolltop Left: Document. Body. scrollleft Page body: window. screentop Page body part left: window. screenleft Screen Resolution Height: window. Screen. Height Screen Resolution width: window. Screen. Width Available screen workspace Height: window. Screen. availheight Available workspace width: window. Screen. availwidth Visible area width of the webpage: Document. Body. clientwidth Visible area height: Document. Body. clientheight Visible area width of the webpage: Document. Body. offsetwidth (including the width of the edge) Visible area height of the webpage: Document. Body. offsetheight (including the height of the edge) Webpage text width: Document. Body. scrollwidth Webpage text height: Document. Body. scrollheight The height of the page to be rolled: Document. Body. scrolltop Left: Document. Body. scrollleft Page body: window. screentop Page body part left: window. screenleft Screen Resolution Height: window. Screen. Height Screen Resolution width: window. Screen. Width Available screen workspace Height: window. Screen. availheight Available workspace width: window. Screen. availwidth Precise HTML positioning: scrollleft, scrollwidth, clientwidth, and offsetwidth Scrollheight: gets the scroll height of an object. Scrollleft: sets or obtains the distance between the left-side border of the object and the leftmost end of the currently visible content in the window. Scrolltop: sets or obtains the distance between the top of the object and the top of the visible content in the window. Scrollwidth: gets the scroll width of an object. Offsetheight: gets the height of an object relative to the layout or the parent coordinate specified by the parent coordinate offsetparent attribute. Offsetleft: obtains the left position of the object relative to the layout or the parent coordinate specified by the offsetparent attribute. Offsettop: obtains the top position of an object relative to the layout or the parent coordinate specified by the offsettop attribute. The horizontal coordinates of event. clientx relative to the document The vertical coordinates of event. clienty relative to the document Horizontal coordinates of event. offsetx relative to the container Event. offsety vertical coordinates of the container Document.doc umentelement. scrolltop vertical scroll Value Event.clientxw.document.doc umentelement. The horizontal coordinate of scrolltop relative to the document + The amount of vertical scrolling ImplementationCode
|
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd> <HTML xmlns = "http://www.w3.org/1999/xhtml"> <Head> <Title> adjust the browser window </title> <meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"> </Meta> <Body> <H2 align = "center"> adjust the browser window size </H2> <HR/> <Form action = "#" method = "get" name = "form1" id = "form1"> <! -- Display the actual size of the browser window --> Actual browser window height: <input type = "text" name = "availheight" size = "4"/> <br/> Actual browser window width: <input type = "text" name = "availwidth" size = "4"/> <br/> </Form> <SCRIPT type = "text/JavaScript"> <! -- VaR winwidth = 0; VaR winheight = 0; Function finddimensions () // function: obtains the size. { // Obtain the window width If (window. innerwidth) Winwidth = Window. innerwidth; Else if (document. Body) & (document. Body. clientwidth )) Winwidth = Document. Body. clientwidth; // Obtain the window height If (window. innerheight) Winheight = Window. innerheight; Else if (document. Body) & (document. Body. clientheight )) Winheight = Document. Body. clientheight; // Detects the body in the document to obtain the window size. If (document.doc umentelement & document.doc umentelement. clientheight & document.doc umentelement. clientwidth) { Winheight = document.doc umentelement. clientheight; Winwidth = document.doc umentelement. clientwidth; } // Output the result to two text boxes Document. form1.availheight. value = winheight; Document. form1.availwidth. value = winwidth; } Finddimensions (); // Call the function to obtain the value Window. onresize = finddimensions; // --> </SCRIPT> </Body> </Html> |
|