The difference between window and document

Source: Internet
Author: User

[Window Object]

It is a top-level object, not another object's property, that is, the browser's window.

Property

Defaultstatus The default status bar message

Document currently displayed (the property itself is an object)

A frame in the frame window ((frame>) (the property itself is an object)

Frames array lists the frame objects of the window, listed in the order in which they appear in the document (the property itself is also a

Object

Historical list of history windows (the property itself is also an object)

Number of frames within the length window

The full (absolute) URL of the document displayed by the Location window (the property itself is an object) do not take it with the document.location

Confusion, which is the URL of the currently displayed document. The user can change window.location (replace the current document with another document), but it cannot be changed

Document.location (because this is where the document is currently displayed)

When the name window opens, give the name of the window

Opener represents the window in which the script that opens the current window with window.open (this is Netscape Navigator 3.0beta 3

A new attribute to enter)

Parent contains a synonym for the window of the current frame. A property of the frame and window objects

Self the synonym of the current window or frame

The message in the status bar

Top contains synonyms for the topmost browser window of the current frame

A synonym for the window or frame that is the same as self

Method

Alert () Open an alert message box

Cleartimeout () Work to terminate the SetTimeout method

Close () Closes the window

Confirm () Opens a Confirm message box, the user can select OK or cancel, if the user clicks OK, the method returns True, click

Cancel returns False

Blur () Moves the focus away from the specified window (this is the new method introduced by Netscape Navigator 3.0 Beta 3)

Focus () Bring the specified window to the foreground (another new method)

Open () Opens a new window

Prompt () Opens a prompt dialog box where the user can type text into the box and return the typed text to the script

SetTimeout () waits a specified number of milliseconds and then runs the instruction event handler event handler

Onload () trigger on page load

Onunload () triggered when the page is closed

[Document Object]

This object is a property of the window and the Frames object and is a document that is displayed in the Windows or frame.

Property

Alinkcolor Color of active links (ALINK)

Anchor a HTMI anchor point, created with the <a name=> tag (the property itself is an object)

Anchors array lists the arrays of the document anchor objects (<a name=>) (the property itself is an object)

BgColor Background color of document (BgColor)

A piece of information stored in a cookie.txt file by a cookie, which is a property of the Document object

Fgcolor the text color of the document (the text attribute in the <BODY> tag)

A form (<FORM>) in the form document (the property itself is an object)

Forms Anay lists an array of form objects in the order in which they appear in the document (the property itself is an object as well)

LastModified Last modified date of document

LinkColor the link color of the document, that is, the link attribute in the <BODY> tag (linked to a document not observed by the user)

A <a href=> tag in the link document (the property itself is also an object)

Links an array of link objects in an array document, arranged in the order in which they appear in the document (the property itself is an object)

Location currently displays the URL of the document. The user cannot change the document.location (because this is where the document is currently displayed). But

Can change window.location (replace the current document with another document) window.location itself is an object, and

Document.location is not an object

Referrer contains the URL of the linked document, which the user clicks to reach the current document

Title of the title document ((title>)

Vlinkcolor a link text color that points to a document that the user has observed, that is, the Vlink attribute of the <BODY> tag

Method

Clear clears the contents of the specified document

Close Document Flow

Open Document Flow

Write writes text to a document

Writeln writes text to the document and ends with a newline character

Difference: 1, window refers to the form. Document refers to the page. Document is a sub-object of window.

2. The user cannot change the document.location (because this is where the document is currently displayed). However, you can change window.location (replace the current document with another document) window.location itself is an object, and Document.location is not an object

The difference between window and document

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.