Daily Notes 20150608

Source: Internet
Author: User

Today's Notes:

1. keyboard monitoring direction key;

2. Get a high width of the visible area of the web screen;

3. Get object location information.

1. Keyboard monitoring direction key, the corresponding key value of the next and next to 38, 40, 37, 39

Document.onkeydown =function(e) {varKey = Window.event?E.keycode:e.which; Switch(key) { Case37:// Left            //TODO             Break;  Case38:// up            //TODO             Break;  Case39:// Right            //TODO             Break;  Case40:// Down            //TODO             Break;          }}; 

2. Get a high width of the web screen visible area

Document.body.clientWidth//Body Object width

Document.body.clientHeight//body Object Height

Document.documentElement.clientWidth//Visible area width

Document.documentElement.clientHeight//Visible area height

Document.body.clientWidth//Web page visible area width

Document.body.clientHeight//Web page visible Area high

Document.body.offsetWidth (including edge width)//web page visible area width

Document.body.offsetHeight (including edge height)//web page visible Area high

Document.body.scrollWidth//page body Full text width

Document.body.scrollHeight//The full text of the Web page is high

Document.body.scrollTop//page is rolled away high

Document.body.scrollLeft//page is rolled away to the left

Window.screentop//Page body part

Window.screenleft//Page body part left

Window.screen.height//High screen resolution

Window.screen.width//width of screen resolution

Window.screen.availHeight//Screen available work area height

Window.screen.availWidth//Screen available work area width

3. Get Object location information

ScrollHeight//Gets the scroll height of the object.

ScrollLeft//Sets or gets the distance between the left edge of the object and the leftmost of the currently visible content in the window

ScrollTop//Sets or gets the distance between the top of the object and the top of the visible content in the window

ScrollWidth//Gets the scrolling width of the object

Offsetheight//Gets the height of the object relative to the layout or parent coordinates specified by the parent coordinate OffsetParent property

Offsetleft//Gets the calculated left position of the object relative to the layout or the parent coordinate specified by the OffsetParent property

OffsetTop//Gets the computed top position of the object relative to the layout or the parent coordinate specified by the OffsetTop property

EVENT.CLIENTX//Relative document level coordinates

Event.clienty//Relative document vertical coordinates

EVENT.OFFSETX//relative container horizontal coordinates

Event.offsety//Relative container vertical coordinates

Document.documentElement.scrollTop//Vertical scrolling values

Event.clientx+document.documentelement.scrolltop//Relative to the document's horizontal coordinates + the amount of scrolling in the vertical direction

Daily Notes 20150608

Related Article

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.