Document objects and window objects in JavaScript _ basic knowledge

Source: Internet
Author: User
Tags time in milliseconds
The document Object and window object of JavaScript are described in detail. Learn more about the common usage of JavaScript. [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)
Anchor is an HTMI anchor. It is created using a tag (this attribute is also an object)
Anchors array lists the array () of document anchors (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.
The text color of the fgColor document (TEXT features in the mark)
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 isLINK feature in tag (LINK to document not observed by the user)
A tag 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 object)
Location: the URL of the currently displayed document. You cannot change document. location (because this is the location of the currently displayed document ). However, you can change window. location (Replace the current document with other documents). window. location is an object, and document. location is not an object.
The URL of the document whose referrer contains the link. You can click this link to reach the current document.
Title document TITLE (title>)
VlinkColor points to the link text color of the document you have observed, that isMarked VLINK features

Method

Clear the content of a specified document
Close Document Stream
Open Document Stream
Write writes text to the document
Writeln writes text to the document and ends with a linefeed.

[Window object]

It is a top-level object, rather than the properties 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 confuse the complete (absolute) URL of the document displayed in the location window (this attribute is itself an object) with the URL of the currently displayed document, such as document. location. You can change window. location (Replace the current document with another document), but you cannot change document. location (because this is the position of the currently displayed document)
When the name window is opened, the name of the window is assigned.
Opener indicates the window in which the script of the current window is opened using window. open (this is a new attribute introduced by Netscape Navigator 3.0 beta 3)
Parent contains the synonym of the current frame window. An attribute of the frame and window objects.
Synonym for self current window or frame
Messages in status bar
Top: Synonym that contains the top-level browser window of the current framework
The synonym for the current window or frame of window, which is the same as self.

Method

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 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.

Event Handler

Triggered when the Onload () page is loaded
Triggered when the Onunload () page is closed

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.