div self height, screen height

Source: Internet
Author: User

Get element height

ScrollWidth//Displays the width of the current element

ScrollHeight//Displays the height of the current element

ScrollLeft//Displays the distance to the left of the current element's left margin

ScrollTop//Displays the height of the top of the current element at the top

Window.innerheight-Interior height of the browser window

Window.innerwidth-Interior width of the browser window

For Internet Explorer 8, 7, 6, 5:

Document.documentElement.clientHeight

Document.documentElement.clientWidth

Or

Document.body.clientHeight

Document.body.clientWidth

Screen.availwidth-Available screen widths

Screen.availheight-The available screen height

Returns the name of the current host

Location.hostname returns the domain name of the web host

Location.pathname returns the path and file name of the current page

Location.port returns the port of the web host (80 or 443)

Location.protocol returns the Web protocol used (HTTP///https://)

Open a window: JS can also be implemented

window.open ()-Open a new window

Window.close ()-Close the current window

Window.moveto ()-Move the current window

Window.resizeto ()-Adjusts the current window's

These tags can get the height and width of the current Div. And the implementation opens in a new window or in the current window.

Data type of JS

  A string (string), a number, a Boolean (Boolean), an array, an object (objects), null (NULL), undefined (Undefined).

JavaScript objects

  

<p id= "Demo" ></p>

<script>
var person = {
FirstName: "John",
LastName: "Doe",
id:5566
};
document.getElementById ("Demo"). InnerHTML =
Person.firstname + "" + person.lastname;
</script>

Creates an object that can be used globally to get the value inside.

div self height, screen height

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.