Typeof document. compatmode! = 'Undefined' & document. compatmode! = 'Backc

Source: Internet
Author: User

Typeof document. compatmode is used here! = 'Undefined' & document. compatmode! = 'Backcomput' indicates that the page rendering method is defined and the standard compatibility mode is enabled. Here, the document.doc umentelement is obtained when the standard compatibility mode is enabled. scrolltop or document. body. when scrolltop is enabled in the standard compatibility mode, you can use document.doc umentelement to retrieve the High-Level wine from the front-end webpage. clientheight. Otherwise, use document. body. clientheight is mainly used to ensure compatibility with various browsers ..

 

 

 

 

Differences between the four browsers on clientheight, offsetheight, scrollheight, clientwidth, offsetwidth, and scrollwidth visible area width of the webpage: document. body. clientwidth: the visible area of the webpage is high: document. body. visible area width of clientheight webpage: document. body. offsetwidth (including the width of the edge) visible area of the webpage Height: document. body. offsetheight (including the edge width): Document. body. scrollwidth: The full text of the webpage is high: document. body. scrollheight the height of the webpage to be rolled: document. body. the left: document. body. scrollleft: window. screent OP: window. screenleft screen resolution Height: window. screen. height the screen resolution width: window. screen. width: available workspace height of the screen: window. screen. availheight available workspace width: window. screen. availwidth here we will talk about the four types of browsers for document. the clientheight, offsetheight, and scrollheight of the body. These four browsers are IE (Internet Explorer), NS (Netscape), opera, and FF (Firefox ). The clientheight browsers have no objection to the clientheight interpretation. They all consider the height of the visible area of the content, that is, the height of the area where the content can be viewed in the page browser, generally, the area below the last toolbar to above the status bar is irrelevant to the page content. Offsetheightie and opera think offsetheight = clientheight + scroll bar + border. NS and FF hold that offsetheight is the actual height of the webpage content, which can be smaller than clientheight. Scrollheightie and opera hold that scrollheight is the actual height of the webpage content, which can be smaller than clientheight. NS and FF think that scrollheight is the height of the webpage content, but the minimum value is clientheight. In short, clientheight is the height of the area where the content is viewed through the browser. NS and FF hold that both offsetheight and scrollheight are the content height of the webpage. However, when the content height of the webpage is less than or equal to clientheight, the value of scrollheight is clientheight, while the value of offsetheight can be less than clientheight. IE and opera hold that offsetheight is the clientheight scroll bar and border in the visible area. Scrollheight indicates the actual height of the webpage content. Similarly, the explanations of clientwidth, offsetwidth, and scrollwidth are the same as those above. You only need to change the height to the width. Note: The above is also a conversion, just a little reference for yourself, some values need to be determined based on the page method! I can't use the above method to set the height of Ajax! Javascript window property: visible area width: document. body. clientwidth: the visible area of the webpage is high: document. body. visible area width of clientheight webpage: document. body. offsetwidth (including the width of the edge) visible area of the webpage Height: document. body. offsetheight (including the edge width): Document. body. scrollwidth: The full text of the webpage is high: document. body. scrollheight the height of the webpage to be rolled: document. body. the left: document. body. scrollleft: window. screentop page text part left: window. screenleft screen resolution Height: window. screen. height the screen resolution width: window. screen. width Available workspace Height: window. screen. availheight available workspace width: window. screen. availwidth can use document in IE, Firefox, and opera. body. clientwidthdocument. body. clientheight can be obtained, which is very simple and convenient. In the company's project: umentelement. clientheight turned out to be W3C standard in a cool http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> if this line of Mark is added to the page in IE: document. body. clientwidth ==> body object width document. body. clientheight => bodyobject height document.doc umentelement. clientwidth ==> wide distance document.doc umentelement. client Height => visible area height note: in IE, "visible area" basically does not recognize the body, but must use documentelement !!!! In Firefox: document. body. clientwidth ==> body object width document. body. clientheight => bodyobject height document.doc umentelement. clientwidth ==> wide distance document.doc umentelement. clientheight => the height of the visible area is in Opera: document. body. clientwidth => visible area width document. body. clientheight ==> zookeeper High Level document.doc umentelement. clientwidth ==> Page Object width (that is, the bodyobject width is added to the marginwidth extension document.doc umentelement. clientheight ==> Page Object height (that is, the height of the body object plus the margin height). Obtain the window height and width: var W = document.doc umentelement. offsetwidth; var hsf-document.doc umentelement. offsetheight;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.