JS gets the current object size and screen resolution, etc.

Source: Internet
Author: User

The effect is as follows:

The code is as follows:

<HTML><Head><title>Gets the current object size, screen resolution, and so on</title><Body><Divstyle= "width:88%;margin:30px auto; color:blue;"ID= "div_html"></Div> <Scripttype= "Text/javascript">     vars= ""; S+= "width of visible area of Web page:"+Document.body.clientWidth+"<br/>"; S+= "Web page Visible Area High:"+Document.body.clientHeight+"<br/>"; S+= "width of visible area of Web page:"+Document.body.offsetWidth+ "(including edges and width of scroll bars)"+"<br/>"; S+= "Web page Visible Area High:"+Document.body.offsetHeight+ "(including the width of the edge)"+"<br/>"; S+= "page Body Full text width:"+Document.body.scrollWidth+"<br/>"; S+= "page Body Full text High:"+Document.body.scrollHeight+"<br/>"; S+= "The Web page is rolled away high (FF):"+Document.body.scrollTop+"<br/>"; S+= "Web page is rolled away high (ie):"+Document.documentElement.scrollTop+"<br/>"; S+= "webpage is rolled away left:"+Document.body.scrollLeft+"<br/>"; S+= "on the body part of the webpage:"+Window.screentop+"<br/>"; S+= "page body part left:"+Window.screenleft+"<br/>"; S+= "High screen resolution:"+Window.screen.height+"<br/>"; S+= "width of screen resolution:"+Window.screen.width+"<br/>"; S+= "screen usable workspace height:"+Window.screen.availHeight+"<br/>"; S+= "screen Usable workspace width:"+Window.screen.availWidth+"<br/>"; S+= "your screen settings are"+window.screen.colorDepth+"bit color"+"<br/>"; S+= "your screen settings"+Window.screen.deviceXDPI+"pixels per inch"+"<br/>";
document.getElementById ("div_html"). InnerHTML=s; </Script></Body></HTML>

The code description diagram is as follows:

Source: JS Gets the current object size and screen resolution, etc.

JS gets the current object size and screen resolution, etc.

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.