How JavaScript gets the height of a Web page

Source: Internet
Author: User

Page visible area wide: document.body.clientWidth

Page visible Area High: document.body.clientHeight

Web page Visible area wide: document.body.offsetWidth (including edge width)

Page visible Area High: document.body.offsetHeight (including edge height)

Page body Full text width: document.body.scrollWidth

The full text of the Web page High: document.body.scrollHeight

Web pages are rolled up high: Document.body.scrollTop

Pages were rolled away to the left: Document.body.scrollLeft

Web 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 Workspace height: window.screen.availHeight

Screen available workspace width: window.screen.availWidth

Because I can't remember it all the time, so turn around and take a look, it should be remembered.

The above belongs to reprint, source http://www.cnblogs.com/wuchao/should be this source?

With this, I can dynamically load the picture code.

1 Document.onmousewheel = function () {

2 var scrolltop = Document.documentElement.scrollTop | | Document.body.scrollTop;

3 var hght = document.body.scrollHeight;

4 if (scrolltop + document.documentElement.clientHeight >= hght) {

5/* Write the code to load the picture here/*

6}

PS: The following convenient to write their own memory here

1.clientWidth and clientheight are the inner dimensions of elements, element content + inner margin

2.offsetWidth and offsetheight refers to the outer dimensions of elements, element content + inner margin + border

3.clientLeft and ClientTop are the values of border-left and border-top of elements, respectively.

4.offsetLeft and offsettop refers to the value of the outer edge of the bounding box of the upper-left corner of the element and the inner margin of the parent container that contains no border border value

5. The Offsetparent object refers to the most recent location (Relative,absolute) ancestor element of an element, which returns null if no ancestor element is positioned.

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/script/

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.