Properties of the window. location object, window. location

Source: Internet
Author: User
Tags time in milliseconds

Properties of the window. location object, window. location

Hash // The URL (Anchor) starting from)

Host // host name and port number of the current URL

Hostname // host name of the current URL

Href // complete URL

Pathname // the path of the current URL

Port // The port number of the current URL

Protocol // protocol of the current URL

Search // question mark (?) Start URL

To use JS to locate the anchor, you can use window. hash with the element ID.

You can use window. location. search to capture the parameters requested by page get in JS, and then use the split method in combination with loop traversal to freely organize the data format.


Question javascript: what are the differences and relationships between window and document objects?

[Window object]
It is a top-level object, not the attribute of another object, that is, the browser window.
Attribute
DefaultStatus default status message
The document currently displayed in the document (this attribute is also an object)
A frame (FRAME>) in the frame window (this attribute is also an object)
Frames array lists the array of Frame Objects in the window in the order they appear in the document (this attribute is also an object)
History List of the history window (this attribute is also an object)
Number of frames in the length window
Do not associate the full (absolute) URL of the document displayed in the location window with a file such as document. location.
Obfuscation. The latter is the URL of the currently displayed document. You can change window. location (Replace the current document with another document), but it cannot.
Document. location (because this is the location of the currently displayed document)
When the name window is opened, the name of the window is assigned.
Opener indicates that window. open is used to open the window where the script of the current window is located.
Parent contains a synonym frame for the current frame window and an attribute of the window object.
Synonym for self current window or frame
Messages in status bar
Top: Synonym that contains the top-level browser window of the current framework
Synonym of the current window or frame of window, same as self
Alert () open an Alert message box
ClearTimeout () is used to terminate the work of the setTimeout method.
Close () close the window
Confirm () opens a Confirm message box. You can select OK or Cancel. If you click OK, this method returns true and click
Cancel returns false
Blur () removes focus from the specified window (this is a new method introduced by Netscape Navigator 3.0 beta 3)
Focus () brings the specified window to the foreground (another new method)
Open () open a new window
Prompt () opens a Prompt dialog box. You can type a text in the box and return the entered text to the script.
SetTimeout () waits for a specified period of time in milliseconds, and then runs the command event handler
Triggered when the Onload () page is loaded
Triggered when the Onunload () page is closed
[Document Object]
This object is an attribute of the window and frames objects. It is a document displayed in a window or frame.
Attribute
AlinkColor activity link color (ALINK)
Anchors array lists the array of document anchors (<a name =>) (This attribute is also an object)
BgColor (BGCOLOR)
Cookie is a piece of information stored in the cookie.txt file. It is an attribute of the Document Object.
TEXT color of the fgColor document (TEXT features in the <BODY> MARK)
Form (<FORM>) (This attribute is also an object)
Forms anay lists an array of form objects in the order they appear in the document (this attribute is also an object)
LastModified document last modification date
The LINK color of the linkColor document, that is, the LINK feature in the <BODY> MARK (LINK to the document not observed by the user)
A <a href => mark in the link document (this attribute is also an object)
An array of link objects in the links array document, arranged in the order they appear in the document (this attribute is also an image)
Location: the URL of the currently displayed document. The user cannot change the full text of docum ......>

Relationship between window object, location object, and History object in javaScript

Window
| _____ DOM
|____ Location
| _____ History

Window is a top-level object

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.