Differences between window and document

Source: Internet
Author: User
Tags close close time in milliseconds

[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

Object)

History List of the history window (this attribute is also an object)

Number of frames in the length window

The complete (absolute) URL of the document displayed in the location window (this attribute itself is also an object ).

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 the window in which the script of the current window is opened using window. Open (this is cited by Netscape Navigator 3.0 Beta 3 ).

A new attribute)

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

Anchor is an htmi anchor. It is created with the <a name => MARK (this attribute is also an object)

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 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 also 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 is, the <body> marked vlink feature

Method

Clear the content of a specified document

Close close Document Stream

Open Document Stream

Write writes text to the document

Writeln writes text to the document and ends with a linefeed.

Difference: 1. Window refers to a form. Document indicates a page. Document is a child object of window.

2. the user 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.

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.