Built-in object_basic knowledge of JavaScript learning notes

Source: Internet
Author: User
This article describes the built-in objects in javascript, including image objects, navigation objects, window objects, screen objects, event objects, historical objects, and file objects (important), anchor object, link object, frame object, form object (important), location object. Here is a brief introduction, which will be explained in detail later. JS Window

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

All browsers support window objects. It indicates the browser window.

All JavaScript global objects, functions, and variables are automatically members of the window object.

Properties and method formats of window objects:

[Window.] Properties

[Window.] method (parameter)

Even the document of html dom is one of the properties of the window object:

Optional parameter Doc ument. getElementById ("header ");
Same as this:

Document. getElementById ("header ");

JS Screen

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

The screen object mainly describes the display and color attributes of the screen.

Properties of the Screen Object:

Format: screen. Properties

Screen. availWidth-available screen width

Screen. availHeight-available screen height

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

JS Location

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

A location object is used to represent the URL Information of a specific window.

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

Some examples:

Location. hostname: The domain name of the web host.

Location. pathname: return the path and file name of the current page.

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

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

The location. href attribute returns the URL of the current page.

The location. assign () method loads a new document.

JS History

History Object: http://www.w3school.com.cn/js/js_window_history.asp

Historical objects are used to store the list of recently accessed URLs of the client.

To protect user privacy, the methods for accessing this object by JavaScript are limited.

Some methods:

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

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

Object

File object: indicates the current HTML object, which is composedThe tag group automatically creates a file object for each HTML file.

Format:

Document. Attributes

Document. Method (parameter)

Link object

Links in the web page are automatically treated as link objects, which are displayed in order as document. links [0], document. links [1]...

Define the format of the link object:

String. link (attribute)

Form object
The object sub-object. The Javascript runtime engine automatically creates a form object for each form.

Format:

Document. forms [Index]. Attributes

Document. forms [Index]. Method (parameter)

Document. form name. Attribute

Document. form name. Method (parameter)

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.