How to get the browser width

Source: Internet
Author: User
How can I obtain the browser width ?, JScriptcode // JS adjust the page height document. getElementById (& quot; leftMenu & quot;). style. height = window. screen. availHeight how to get the browser width
What is the specific usage?

------ Solution --------------------
JScript code
// Adjust the page height in JS document. getElementById ("leftMenu "). style. height = window. screen. availHeight; // The height of the menu navigation is equal to that of the browser. document. getElementById ("rightMessage "). style. height = window. screen. availHeight; // The height of the information on the right is equal to the height of the browser; document. getElementById ("leftMenu "). style. height = document. getElementById ("rightMessage "). style. height; // make the height of both sides equal; // when using the height percentage in the div, you must set that the parent element of the div is 100%
------ Solution --------------------
Html dom innerheight and innerwidth attributes
The read-only attribute declares the height and width of the document display area of the window, in pixels.
The width and height do not include the height of the menu bar, toolbar, and scroll bar.
IE does not support these attributes. It is replaced by the clientWidth and clientHeight attributes of document.doc umentElement or ducument. body (related to the IE version.


All these questions are answered by w3school. Don't be lazy. the lazy you miss, the more you miss.

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.