Home > Web Front-end > JS Tutorial > Detailed explanation of JavaScript document object and window object_Basic knowledge

Detailed explanation of JavaScript document object and window object_Basic knowledge

WBOY
Release: 2016-05-16 18:12:49
Original
1211 people have browsed it
[document object]
This object is an attribute of the window and frames objects, and is a document displayed in the window or frame.

Attributes

alinkColor The color of the active link (ALINK)
anchor An HTML anchor, created using the tag (the attribute itself is also an object)
anchors array column Array of document anchor objects (
) (this attribute itself is also an object)
bgColor The background color of the document (BGCOLOR)
Cookie is a piece of information stored in the cookie.txt file, which is the document An attribute of the object
fgColor The text color of the document (TEXT attribute in the tag)
form A form (
) in the document (the attribute itself is also an object)
forms anay An array of form objects listed in the order they appear in the document (this property itself is also an object)
LastModified The last modified date of the document
linkColor The color of the link in the document, that is, the color in the tag LINK attribute (link to a document that the user has not observed)
 link A
tag in the document (the attribute itself is also an object)
links array An array of link objects in the document, as they appear in the document The order in (this attribute itself is also an object)
Location The URL of the currently displayed document. The user cannot change document.location (because this is the location where the document is currently displayed). However, window.location can be changed (replacing the current document with another document) window.location itself is also an object, and document.location is not an object
Referrer contains the URL of the linked document. The user can click the link to reach the current document
Title The title of the document ((TITLE>)
vlinkColor The text color of the link pointing to the document that the user has observed, that is, the VLINK attribute of the tag

Method

clear Clear Specify the content of the document
close close the document stream
open open the document stream
write write the text into the document
writeln write the text into the document and end with a newline character

[window object]

It is a top-level object, not a property of another object, that is, the browser window

Property

defaultStatus Default. Status bar message
Document currently displayed document (the attribute itself is also an object)
frame A frame in the window ((FRAME>) (the attribute itself is also an object)
frames array lists the frames of the window An array of objects, listed in the order in which these objects appear in the document (the property itself is also an object)
History The history list of the window (the property itself is also an object)
length The number of frames in the window
Location The complete (absolute) URL of the document displayed in the window (this property itself is also an object). Do not confuse it with document.location, which is the URL of the currently displayed document. The user can change window.location (using another document). replace the current document), but cannot change document.location (because this is the location where the document is currently displayed)
Name is the name given to the window when the window is opened
opener represents the location of the script that uses window.open to open the current window. The window (this is a new attribute introduced in Netscape Navigator 3.0beta 3)
 Parent contains a synonym for the window of the current frame. An attribute of the frame and window objects
Self A synonym for the current window or frame
Status Message in the status bar
top contains the synonym of the topmost browser window of the current frame
window synonym of the current window or frame, the same as self

Method

alert() Open an Alert message box
clearTimeout() used to terminate the work of the setTimeout method
close() close the window
confirm() open a Confirm message box, the user can choose OK or Cancel, if the user clicks OK , this method returns true, click Cancel to return false
 blur() Move the focus away from the specified window (this is a new method introduced in Netscape Navigator 3.0 beta 3)
 focus() Bring the specified window to the foreground (Another new method)
open() Open a new window
prompt() Open a Prompt dialog box, the user can type text into the box and return the typed text to the script
setTimeout() Wait for a specified number of milliseconds, and then run the command event handler

Event handler

Onload() Triggered when the page is loaded
Onunload() Triggered when the page is closed
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template