The difference between window objects and document objects

window object with the difference between the document object
[window object]

  It is a top-level object, rather than an attribute of another object, namely the browser window.

  Attributes

  The default status messages defaultStatus

  document the current document (the attribute itself is a target) displayed

  frame of a window frame ((FRAME>) (the property itself is a target)

  frames array include an array of window frame objects, these objects appear in the order listed in the document (the attribute itself is a

Object)

  History list (the attribute itself is a target) history window

  The number of the frame within the window of length

   location window display the full (absolute) URL (the attribute itself is a target) document and do not take it as document.location

Confusion, which is the URL of the currently displayed document. Users can change window.location (using another document to replace the current document), but it can not be changed

document.location (because this is the current display position of the document)

  name window opens, giving the name of the window

  Representatives opener using window.open to open the script window, where the current window (which is Netscape Navigator 3.0beta 3 cited

Into a new property)

  Synonym parent comprising the current window frame. Window frame and an attribute of the object

  Synonym self current window or frame

  status message in the status bar

  Synonymous with top frame contains the current topmost browser window

  Synonym current window or window frame, and the same self

  method

  alert () opens a message box Alert

  the clearTimeout () method is used to terminate the work of setTimeout

  close () Close

   confirm () Confirm message to open a box, the user can select the OK or Cancel, if the user clicks OK, the method returns true, clicking

Cancel returns false

   Blur () the focus from the specified window (which is a new method of introducing the Netscape Navigator 3.0 beta 3)

  focus () the specified window to the foreground (another new method)

  open () opens a new window

   prompt () Prompt to open a dialog box, the user can type text to the box, and the typed text to return to the script

  setTimeout () waits for a specified number of milliseconds, then the operation command event handler event handler

  Onload () is triggered when the page loads

  Onunload () is triggered when the page is closed

[Document objects]

  The object is a property of the window frames and the object is displayed within a document window or frame.

  Attributes

  alinkColor active link color (ALINK)

  anchor a HTMI anchor, use <A NAME=> tags to create (the property itself is a target)

  anchors array lists an array of documents anchor objects (<A NAME=>) (the property itself is a target)

  BgColor background color of the document (BGCOLOR)

  a piece of information stored in a cookie in cookie.txt file, which is an attribute of the document object

  Text color fgColor document (TEXT mark in the properties)

  A form form document (

) (The property itself is a target)

  forms anay listed in an array (the property itself is a target) form object in the order they appear in the document

  lastModified document last modified date

  LinkColor link color document, i.e. LINK tag characteristics (linked to the document the user is not observed)

  <A HREF=> a link tag in the document (the property itself is a target)

  A link in the links array array of objects in the document, the arrangement (the property itself is a target) in the order they appear in the document

  location is currently displayed document's URL. Users can not change document.location (because this is the location of the current display of the document). but,

You can change the window.location (substituted with other documents in the current document) the window.location itself is a target, and

document.location not an object

  URL referrer document contains links, the user clicks the link can reach the current document

  Title title of the document ((TITLE>)

  vlinkColor point the user has observed link text color of the document, that characteristic mark of VLINK

  method

  clear clear the contents of the specified document

  close close the document flow

  Open to open the document flow

   write write text into a document

  writeln write text into documents, and with the terminating newline

Difference: 1, window refers to the form. document refers to the page. document is a child window object.

    2、用户不能改变 document.location(因为这是当前显示文档的位置)。但是,可以改变window.location (用其它文档取代当前文档)window.location本身也是一个对象,而document.location不是对象

Guess you like

Origin www.cnblogs.com/dillonmei/p/12578702.html