JavaScript Learning notes in the built-in objects _ basics

Source: Internet
Author: User

JS Window

Window objects: http://www.w3school.com.cn/js/js_window.asp

Window objects are supported by all browsers. It represents the browser window.

All JavaScript global objects, functions, and variables automatically become members of the Window object.

Properties and method formats for window objects:

[Window.] Property

[Window.] Method (Parameters)

Even the document of the HTML DOM is one of the properties of the Window object:

Window.document.getElementById ("header");
Same as this:

document.getElementById ("header");

JS Screen

Screen objects: http://www.w3school.com.cn/js/js_window_screen.asp

Screen objects mainly describe the display and color properties of the screen.

Properties of Screen objects:

Format: Screen. Properties

Screen.availwidth-Available Screen width

Screen.availheight-Available Screen heights

In pixels, subtract interface features, such as window taskbar.

JS Location

Location object: http://www.w3school.com.cn/js/js_window_location.asp

The location object is used to represent the URL information for a particular window.

The Window.location object does not use the prefix of window when writing.

Some examples:

Location.hostname returns the domain name of the web host

Location.pathname returns the path and filename of the current page

Location.port return to the web host's port (80 or 443)

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

The Location.href property returns the URL of the current page.

The Location.assign () method loads the new document.

JS History

Historical objects: http://www.w3school.com.cn/js/js_window_history.asp

Historical objects are used to store lists of URLs that the client has recently visited.

To protect user privacy, there are restrictions on how JavaScript accesses the object.

Some methods:

History.back ()-Same as clicking the Back button in the browser

History.forward ()-Same as clicking the button in the browser forward

File objects

File objects: Represents the current HTML object, is composed of <body> tag group, each HTML file will automatically create a file object.

Format:

Document. Properties

Document. Method (Parameters)

Linked objects

The links in the Web page are automatically treated as linked objects and, in order, are represented as document.links[0],document.links[1] ...

Define the format of the linked object:

String. Link (properties)

Form objects
the child object of the file object, and the JavaScript runtime engine automatically creates a Form object for each form.

Format:

document.forms[index]. Properties

document.forms[index]. Method (Parameters)

Document. Name of the form. property

Document. Name of the form. Method (Parameters)

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.