JavaScript Instance Tutorial: Web page Move the dragged JS attribute

Source: Internet
Author: User

Article Introduction: do move, drag the commonly used JS properties.

1.clientHeight, ClientWidth:
These two properties show, in general, the pixel height and width of the element's content. Theoretically, these measurements do not consider any entry through the stylesheet
The page margins, borders, and so on in the element.

2.clientleft,clienttop:
These two return the thickness of the border around the element, and if you do not specify a border or do not locate the modifier, his value is 0.

3.scrollleft,scrolltop:
If the elements are scrollable, you can use these properties to get how far the element scrolls in both horizontal and vertical directions, in pixels.
These values are always 0 for elements that cannot be scrolled.

4.scrollheight,scrollwidth:
No matter how many objects are visible on the page, they get the whole. Top

<script language= "JavaScript" >
var s = "";
s + = "\ r \ n page visible area wide:" + document.body.clientWidth;
s + + "\ r \ n page visible Area High:" + document.body.clientHeight;
s + + "\ r \ n" page visible area High: "+ Document.body.offsetWeight +" (including the edge of the width);
s + + "\ r \ n" page visible area High: "+ Document.body.offsetHeight +" (including the edge of the width);
s + + "\ r \ n page text full text width:" + document.body.scrollWidth;
s + + "\ r \ n" page full text High: "+ document.body.scrollHeight;
s + + "\ r \ n Pages are rolled High:" + document.body.scrollTop;
s + + "\ r \ n page is rolled to the left:" + document.body.scrollLeft;
s + + "\ r \ n Page body part:" + window.screentop;
s + + "\ r \ n Page body part left:" + window.screenleft;
s + + "\ r \ n screen resolution of High:" + window.screen.height;
s + + "\ r \ n Screen resolution width:" + window.screen.width;
s + = "\ r \ n Screen available working area height:" + window.screen.availHeight;
s + = "\ r \ n Screen available working area width:" + window.screen.availWidth;
alert (s);
</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.