[Javascript location attribute] window object

Source: Internet
Author: User

 

For the various location attributes in javascript, what is previously required when writing special effects is used, and the system has not summarized them seriously. Location attributes play an important role in many special effects. If the browser has the same interpretation of each attribute, we do not need to waste too much effort, because different browsers have different interpretations for each attribute.

This article covers the attributes of various locations of various mainstream objects. If there are any errors or omissions, please do not cherish your text.

To sum up these attributes, you can also give yourself an explanation.

Window object

  • InnerHeight
  • InnerWidth
  • OuterHtight
  • OuterWidth
  • PageXOffset
  • PageXOffset
  • ScreenLeft
  • ScreenTop
  • ScreenX
  • ScreenY

  InnerHeight innerWidth

 

InnerHeight

Return the height of the document display area in the window.

InnerWidth

Return window document County/City width

 

Browser compatibility:

    

Instance code: [test in FF]

  

Effect implementation:

 

  OuterHeight outerWidth

  

OuterHeight

Return the external height of the window, including the toolbar and scroll bar.

OuterWidth

Return the external width of the window, including the toolbar and scroll bar.

Browser compatibility:

Code implementation: [test in FF]

 

Effect implementation:

 

PageXOffset pageYOffset

PageXOffset

Declares the number of vertices that have been rolled to the right of the current document.

PageYOffset

Declare the number of vertices that have been rolled down in the current document

 

IE does not support these attributes. IE uses the scrollLeft and scrollTop attributes of document. dacumentElement or document. body.

Browser compatibility:

 

Instance code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 1111111111111111111111111111111111111111111111111111111111
  11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111  <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>  2  <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> </body>

Effect example:

 

 

ScreenTop screenLeft screenX screenY

  

ScreenTop

A read-only integer that declares the Y coordinate in the upper left corner of the window.

ScreenLeft

A read-only integer that specifies the X coordinate in the upper left corner of the window.

ScreenX

A read-only integer that specifies the X coordinate in the upper left corner of the window.

ScreenY

A read-only integer that declares the Y coordinate in the upper left corner of the window.

Browser compatibility:

ScreenTop screenLeft

 

ScreenX screenY

Instance code:

  

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

Effect example:

Test in Chrom:

Test in FF:

 

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.