Explanation: Get page element width and height method and plot

Source: Internet
Author: User

Jsoffsetwidth\offsetleft <wbr> Other text explanation

Web page Visible area width: document.body.clientWidth;

Web page Visible Area High: document.body.clientHeight;

Web page Visible Area width: document.body.offsetWidth (including the width of the edge);

Web page Visible Area High: document.body.offsetHeight (including the width of the edge);

Page body Full text width: document.body.scrollWidth;

Page body Full text High: document.body.scrollHeight;

The page was rolled High: document.body.scrollTop;

The webpage is rolled away left: document.body.scrollLeft;

Page body part: window.screentop;

Page body part left: window.screenleft;

High screen resolution: window.screen.height;

Width of screen resolution: Window.screen.width;

Screen available working area height: window.screen.availHeight;

Screen available working area width: window.screen.availWidth;

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 horizontal coordinates of relative documents

Event.clienty vertical coordinates of relative documents

Event.offsetx horizontal coordinates relative to the container

Event.offsety the vertical coordinate of the relative container

Document.documentElement.scrollTop The vertical scrolling value

Event.clientx+document.documentelement.scrolltop horizontal coordinates of relative documents + amount of vertical scrolling

The above mainly refers to IE, Firefox differences are as follows:

IE6.0, ff1.06+:

clientwidth = width + padding

clientheight = height + padding

offsetwidth = width + padding + border

offsetheight = height + padding + border

ie5.0/5.5:

ClientWidth = Width-border

ClientHeight = Height-border

offsetwidth = width

offsetheight = height

HTML control offsettop, ScrollTop, and other properties

Assume that obj is an HTML control.

Obj.offsettop refers to the position of obj above or above the control, integral type, in pixels.

Obj.offsetleft refers to the position of obj from the left or upper control, the integer type, in pixels.

Obj.offsetwidth refers to the width, integer, and unit pixels of the obj control itself.

Obj.offsetheight refers to the height, integer, and unit pixels of the obj control itself.

Explanation: Get page element width and height method and plot

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.