Packagedom.html
Classpublic class HTMLDocument
InheritanceHTMLDocument Inheritance Document Inheritance Node Inheritance Object
Implements XPathEvaluator

Introduced in: DOM 0 
Modified in: HTML 5 

An HTMLDocument is the root of the HTML hierarchy and holds the entire content.

Besides providing access to the hierarchy, it also provides some convenience methods for accessing certain sets of information from the document.

The following properties have been deprecated in favor of the corresponding ones for the BODY element:

See also

MSDN - document Object
MSDN - HTMLDocument Prototype
MDC - Document
W3C - HTMLDocument


Public Properties
 PropertyDefined By
  HTML 5 activeElement : Element
[read-only] Returns the currently focused element.
HTMLDocument
   Deprecated alinkColor : DOMString
Returns or sets the color of an active link in the document body.
HTMLDocument
  Non-Standard all : HTMLCollection
[read-only] Returns a reference to the collection of elements contained by the object.
HTMLDocument
  DOM 1 HTML anchors : HTMLCollection
[read-only] A collection of all the anchor (A) elements in a document with a value for the name attribute.
HTMLDocument
  DOM 1 HTML applets : HTMLCollection
[read-only] A collection of all the OBJECT elements that include applets and APPLET (deprecated) elements in a document.
HTMLDocument
 InheritedDOM 3 Load and Save Obsolete async : Boolean
Indicates whether the method load should be synchronous or asynchronous.
Document
 InheritedDOM 1 Core attributes : NamedNodeMap
[read-only] Returns an unordered collection of Attr nodes.
Node
   Deprecated background : DOMString
URI of the background texture tile image.
HTMLDocument
 InheritedNon-Standard baseName : DOMString
[read-only] Returns the base name for the name qualified with the namespace.
Node
 InheritedDOM 3 Core baseURI : DOMString
[read-only] The absolute base URI of this node or null if the implementation wasn't able to obtain an absolute URI.
Node
  Non-Standard baseURIObject : nsIURI
[read-only] baseURIObject returns the nsIURI object representing the document's URI.
HTMLDocument
   Deprecated bgColor : DOMString
Gets/sets the background color of the current document.
HTMLDocument
  DOM 1 HTML body : HTMLElement
The element that contains the content for the document.
HTMLDocument
  DOM 0 characterSet : DOMString
Returns the character encoding of the current document.
HTMLDocument
  HTML 5 charset : DOMString
Sets or retrieves the character set used to encode the object.
HTMLDocument
 InheritedDOM 1 Core childNodes : NodeList
[read-only] Returns an ordered collection of node objects that are children of the current element.
Node
  Non-Standard compatible : HTMLCollection
[read-only] Retrieves the collection of user agents and versions declared in the X-UA-Compatible meta tag.
HTMLDocument
  HTML 5 compatMode : DOMString
Indicates whether the document is rendered in Quirks mode or Strict mode.
HTMLDocument
  Non-Standard contentType : DOMString
[read-only] Returns the Content-Type from the HTTP headers of the document.
HTMLDocument
  DOM 0 cookie : DOMString
Get and set the cookies associated with the current document.
HTMLDocument
 InheritedNon-Standard dataType : *
Specifies the data type for this node.
Node
  HTML 5 defaultCharset : DOMString
[read-only] Gets the default character set from the current regional language settings.
HTMLDocument
 InheritedDOM 2 Views defaultView : AbstractView
[read-only] The default AbstractView for this Document, or null if none available.
Document
 InheritedNon-Standard definition : Node
[read-only] Returns the definition of the node in the document type definition (DTD) or schema.
Node
  Non-Standard designMode : DOMString
Sets or gets a value that indicates whether the document can be edited.
HTMLDocument
  Non-Standard dir : DOMString
Sets or retrieves a value that indicates the reading order of the object.
HTMLDocument
 InheritedDOM 1 Core doctype : DocumentType
[read-only] The Document Type Declaration (see DocumentType) associated with this document.
Document
 InheritedDOM 1 Core documentElement : Element
[read-only] This is a convenience attribute that allows direct access to the child node that is the document element of the document.
Document
  Non-Standard documentMode : Number
[read-only] Retrieves the document compatibility mode of the document.
HTMLDocument
 InheritedDOM 3 Core documentURI : DOMString
The location of the document or null if undefined or if the Document was created using DOMImplementation.createDocument.
Document
  Non-Standard documentURIObject : nsIURI
[read-only] Returns an nsIURI object representing the URI of the document.
HTMLDocument
  DOM 1 HTML domain : DOMString
Gets/sets the domain of the current document.
HTMLDocument
 InheritedDOM 3 Core domConfig : DOMConfiguration
[read-only] The configuration used when Document.normalizeDocument() is invoked.
Document
  DOM 0 embeds : HTMLCollection
[read-only] Retrieves a collection of all embed objects in the document.
HTMLDocument
  Non-Standard expando : Boolean
Sets or retrieves a value indicating whether arbitrary variables can be created within the object.
HTMLDocument
   Deprecated fgColor : DOMString
Gets/sets the foreground color, or text color, of the current document.
HTMLDocument
  Non-Standard fileCreatedDate : DOMString
[read-only] Retrieves the date the file was created.
HTMLDocument
  Non-Standard fileModifiedDate : DOMString
[read-only] Retrieves the date the file was last modified.
HTMLDocument
  Non-Standard fileSize : DOMString
[read-only] Retrieves the file size.
HTMLDocument
 InheritedDOM 1 Core firstChild : Node
[read-only] Returns the node's first child in the tree, or null if the node is childless.
Node
  DOM 1 HTML forms : HTMLCollection
[read-only] A collection of all the forms of a document.
HTMLDocument
  Non-Standard frames : HTMLCollection
[read-only] Retrieves a collection of all window objects defined by the given document or defined by the document associated with the given window.
HTMLDocument
  DOM 0 height : Number
Returns the height of the body element of the current document.
HTMLDocument
  DOM 1 HTML images : HTMLCollection
[read-only] A collection of all the IMG elements in a document.
HTMLDocument
 InheritedDOM 1 Core implementation : DOMImplementation
[read-only] The DOMImplementation object that handles this document.
Document
 InheritedDOM 3 Core inputEncoding : DOMString
[read-only] Returns a string representing the encoding under which the document was parsed (e.g.
Document
 InheritedDOM 1 Core lastChild : Node
[read-only] Returns the last child of a node.
Node
  DOM 0 lastModified : DOMString
[read-only] Returns a string containing the date and time on which the current document was last modified, in the form "MM/DD/YY hh:mm:ss".
HTMLDocument
 InheritedCSSOM lastStyleSheetSet : DOMString
[read-only] This attribute must initially have the value null.
Document
   Deprecated linkColor : DOMString
Gets/sets the color of links within the document.
HTMLDocument
  DOM 1 HTML links : HTMLCollection
[read-only] A collection of all AREA elements and anchor (A) elements in a document with a value for the href attribute.
HTMLDocument
 InheritedDOM 2 Core localName : DOMString
[read-only] Returns the local part of the qualified name of this node.
Node
  DOM 0 location : Location
[read-only] Returns a Location object, which contains information about the URL of the document and provides methods for changing that URL.
HTMLDocument
  Non-Standard namespaces : HTMLCollection
[read-only] Retrieves a collection of namespace objects.
HTMLDocument
 InheritedDOM 2 Core namespaceURI : DOMString
[read-only] The namespace URI of the node, or null if it is unspecified (read-only).
Node
 InheritedDOM 1 Core nextSibling : Node
[read-only] Returns the node immediately following the specified one in its parent's childNodes list, or null if the specified node is the last node in that list.
Node
 InheritedDOM 1 Core nodeName : DOMString
[read-only] Returns the name of the current node as a string.
Node
 InheritedNon-Standard nodePrincipal : nsIPrincipal
[read-only] Returns the nsIPrincipal object representing current security context of the node.
Node
 InheritedDOM 1 Core nodeType : Number
[read-only] Returns an integer code representing the type of the node.
Node
 InheritedNon-Standard nodeTypedValue : *
Contains the node value expressed in its defined data type.
Node
 InheritedNon-Standard nodeTypeString : DOMString
[read-only] Returns the node type in string form.
Node
 InheritedDOM 1 Core nodeValue : DOMString
Returns or sets the value of the current node.
Node
 InheritedDOM 1 Core ownerDocument : Document
[read-only] The Document object associated with this node.
Node
 InheritedDOM 1 Core parentNode : Node
[read-only] Returns the parent of the specified node in the DOM tree.
Node
  Non-Standard parentWindow : Window
[read-only] Gets a reference to the container object of the window.
HTMLDocument
 InheritedNon-Standard parsed : Boolean
[read-only] Indicates the parsed status of the node and child nodes.
Node
  DOM 0 plugins : HTMLCollection
[read-only] Returns an HTMLCollection object containing one or more HTMLEmbedElements or null which represent the <embed> elements in the current document.
HTMLDocument
 InheritedCSSOM preferredStyleSheetSet : DOMString
[read-only] This attribute must be the preferred style sheet set as set by the author.
Document
 InheritedDOM 2 Core prefix : DOMString
Returns the namespace prefix of the specified node, or null if no prefix is specified.
Node
 InheritedDOM 1 Core previousSibling : Node
[read-only] Returns the node immediately preceding the specified one in its parent's childNodes list, null if the specified node is the first in that list.
Node
  Non-Standard protocol : DOMString
Sets or retrieves the protocol portion of a URL.
HTMLDocument
  HTML 5 readyState : DOMString
[read-only] Retrieves a value that indicates the current state of the object.
HTMLDocument
  DOM 1 HTML referrer : DOMString
[read-only] Returns the URI of the page that linked to this page.
HTMLDocument
  HTML 5 scripts : HTMLCollection
[read-only] Returns an HTMLCollection object containing one or more HTMLScriptElements or null which represent the <script> elements in the current document.
HTMLDocument
 InheritedCSSOM selectedStyleSheetSet : DOMString
This attribute indicates which style sheet set is in use.
Document
  Non-Standard selection : Selection
[read-only] Represents the active selection, which is a highlighted block of text or other elements in the document that a user or a script can carry out some action on.
HTMLDocument
 InheritedNon-Standard specified : Boolean
[read-only] Indicates whether the node (usually an attribute) is explicitly specified or derived from a default value in the document type definition (DTD) or schema.
Node
 InheritedDOM 3 Core strictErrorChecking : Boolean
An attribute specifying whether error checking is enforced or not.
Document
 InheritedDOM 2 Style styleSheets : StyleSheetList
[read-only] A list containing all the style sheets explicitly linked into or embedded in a document.
Document
 InheritedCSSOM styleSheetSets : DOMStringList
[read-only] This must be a live list of the currently available style sheet sets.
Document
 InheritedNon-Standard text : DOMString
Represents the text content of the node or the concatenated text representing the node and its descendants.
Node
 InheritedDOM 3 Core textContent : DOMString
Gets or sets the text content of a node and its descendants.
Node
  DOM 1 HTML title : DOMString
Gets or sets the title of the document.
HTMLDocument
  Non-Standard uniqueID : DOMString
[read-only] Retrieves an autogenerated, unique identifier for the object.
HTMLDocument
  DOM 1 HTML URL : DOMString
[read-only] Returns the URL of the current document.
HTMLDocument
  Non-Standard URLUnencoded : DOMString
[read-only] Gets the URL for the document, stripped of any character encoding.
HTMLDocument
   Deprecated vlinkColor : DOMString
Gets/sets the color of links that the user has visited in the document.
HTMLDocument
  DOM 0 width : Number
Returns the width of the body element of the current document in pixels.
HTMLDocument
 InheritedNon-Standard xml : DOMString
[read-only] Contains the XML representation of the node and all its descendants.
Node
 InheritedDOM 3 Core xmlEncoding : DOMString
[read-only] An attribute specifying, as part of the XML declaration, the encoding of this document.
Document
 InheritedDOM 3 Core xmlStandalone : Boolean
An attribute specifying, as part of the XML declaration, whether this document is standalone.
Document
 InheritedDOM 3 Core xmlVersion : DOMString
An attribute specifying, as part of the XML declaration, the version number of this document.
Document
  Non-Standard XSLDocument : DOMObject
[read-only] Retrieves a reference to the top-level node of the Extensible Stylesheet Language (XSL) document.
HTMLDocument
Public Methods
 MethodDefined By
 Inherited
DOM 3 Load and Save Obsolete abort():void
If the document is currently being loaded as a result of the method load being invoked the loading and parsing is immediately aborted.
Document
 Inherited
DOM 2 Events addEventListener(type:DOMString, listener:EventListener, useCapture:Boolean):void
Associates a function with a particular event and binds the event to the current node.
Node
 Inherited
DOM 3 Events addEventListenerNS(namespaceURI:DOMString, type:DOMString, listener:EventListener, useCapture:Boolean):void
Registers an event listener, depending on the useCapture parameter, on the capture phase of the DOM event flow or its target and bubbling phases.
Node
 Inherited
DOM 3 Core adoptNode(source:Node):Node
Attempts to adopt a node from another document to this document.
Document
 Inherited
DOM 1 Core appendChild(element:Node):Node
Adds a node to the end of the list of children of a specified parent node.
Node
 Inherited
Non-Standard attachEvent(type:DOMString, listener:Function):Boolean
Binds the specified function to an event, so that the function gets called whenever the event fires on the object.
Document
 Inherited
DOM 3 Events canDispatch(namespaceURI:DOMString, type:DOMString):Boolean
Tests if the implementation can generate events of a specified type.
Document
  
Non-Standard Obsolete captureEvents(eventTypeList:DOMString):void
Instructs the browser to grab events of a specific type before they reach their intended target document objects.
HTMLDocument
  
 Deprecated clear():void
This method used to clear the whole specified document in early (pre-1.0) versions of Mozilla.
HTMLDocument
 Inherited
DOM 1 Core cloneNode(cloneChildren:Boolean):Node
Returns a duplicate of the current node.
Node
  
DOM 1 HTML close():void
Closes a document stream opened by open() and forces rendering.
HTMLDocument
 Inherited
DOM 3 Core compareDocumentPosition(other:Node):Number
Compares the position of the current node against another node in any other document.
Node
 Inherited
DOM 1 Core createAttribute(name:DOMString):Attr
Creates an Attr of the given name.
Document
 Inherited
DOM 2 Core createAttributeNS(namespaceURI:DOMString, qualifiedName:DOMString):Attr
Creates an attribute of the given qualified name and namespace URI.
Document
 Inherited
Creates a CDATASection node whose value is the specified string.
Document
 Inherited
DOM 1 Core createComment(data:DOMString):Comment
Creates a Comment node given the specified string.
Document
 Inherited
Creates an empty DocumentFragment object.
Document
 Inherited
DOM 1 Core createElement(tagName:DOMString):Element
Creates an element of the type specified.
Document
 Inherited
DOM 2 Core createElementNS(namespaceURI:DOMString, qualifiedName:DOMString):Element
Creates an element of the given qualified name and namespace URI.
Document
 Inherited
Creates an EntityReference object.
Document
 Inherited
DOM 2 Events createEvent(eventType:DOMString):Event
Creates an event object of the type specified.
Document
 Inherited
Non-Standard createEventObject(existingEvent:Event = null):Event
Generates an event object to pass event context information when you use the fireEvent method.
Document
  
DOM 3 XPath createExpression(expression:DOMString, resolver:XPathNSResolver):XPathExpression
Creates a parsed XPath expression with resolved namespaces.
HTMLDocument
 Inherited
DOM 3 Load and Save createLSInput():LSInput
Create a new empty input source object where LSInput.characterStream, LSInput.byteStream, LSInput.stringData LSInput.systemId, LSInput.publicId, LSInput.baseURI, and LSInput.encoding are null, and LSInput.certifiedText is false.
Document
 Inherited
DOM 3 Load and Save createLSOutput():LSOutput
Create a new empty output destination object where LSOutput.characterStream, LSOutput.byteStream, LSOutput.systemId, LSOutput.encoding are null.
Document
 Inherited
DOM 3 Load and Save createLSParser(mode:Number, schemaType:DOMString):LSParser
Create a new LSParser.
Document
 Inherited
DOM 3 Load and Save createLSSerializer():LSSerializer
Create a new LSSerializer object.
Document
 Inherited
DOM 2 TR createNodeIterator(root:Node, whatToShow:Number, filter:NodeFilter, entityReferenceExpansion:Boolean):NodeIterator
Create a new NodeIterator over the subtree rooted at the specified node.
Document
  
DOM 3 XPath createNSResolver(nodeResolver:Node):XPathNSResolver
Adapts any DOM node to resolve namespaces so that an XPath expression can be easily evaluated relative to the context of the node where it appeared within the document.
HTMLDocument
 Inherited
Creates a ProcessingInstruction node given the specified name and data strings.
Document
 Inherited
DOM 2 TR createRange():Range
This interface can be obtained from the object implementing the Document interface using binding-specific casting methods.
Document
 Inherited
Non-Standard createStyleSheet(url:DOMString = null, index:Number):StyleSheet
Creates a style sheet for the document.
Document
 Inherited
DOM 1 Core createTextNode(data:DOMString):Text
Creates a Text node given the specified string.
Document
 Inherited
DOM 2 TR createTreeWalker(root:Node, whatToShow:Number, filter:NodeFilter, entityReferenceExpansion:Boolean):TreeWalker
Create a new TreeWalker over the subtree rooted at the specified node.
Document
 Inherited
Non-Standard detachEvent(type:DOMString, listener:Function):void
Unbinds the specified function from the event, so that the function stops receiving notifications when the event fires.
Document
 Inherited
DOM 2 Events dispatchEvent(evt:Event):Boolean
Dispatches an event to fire on a node artificially.
Node
 Inherited
CSSOM View elementFromPoint(x:Number, y:Number):Element
Returns the element from the document whose elementFromPoint method is being called which is the topmost element which lies under the given point.
Document
 Inherited
Invoking this method must change the disabled attribute on each StyleSheet object with a title in the styleSheets attribute, so that all those whose title matches the name argument are enabled, and all others are disabled.
Document
  
DOM 3 XPath evaluate(expression:DOMString, contextNode:Node, resolver:XPathNSResolver, type:Number, result:DOMObject):DOMObject
Evaluates an XPath expression string and returns a result of the specified type if possible.
HTMLDocument
  
Non-Standard execCommand(aCommandName:DOMString, aShowDefaultUI:Boolean, aValueArgument:DOMString):Boolean
When an HTML document has been switched to designMode, the document object exposes the execCommand method which allows one to run commands to manipulate the contents of the editable region.
HTMLDocument
  
Non-Standard execCommandShowHelp(aCommandName:DOMString):Boolean
Displays help information for the given command identifier.
HTMLDocument
  
Non-Standard fireEvent(type:DOMString, event:Object = null):Boolean
Fires a specified event on the object.
HTMLDocument
  
Non-Standard focus():void
Causes the element to receive the focus and executes the code specified by the onfocus event.
HTMLDocument
  
Non-Standard getBoxObjectFor(element:Element):nsIBoxObject
This particular method was a way for XUL elements to efficiently determine their position, amongst other things.
HTMLDocument
  
Returns a set of elements with the given class name.
HTMLDocument
  
DOM 1 HTML getElementsByName(elementName:DOMString):NodeList
Returns a list of elements with a given name in the (X)HTML document.
HTMLDocument
 Inherited
Returns a NodeList of all the Elements in document order with a given tag name and are contained in the document.
Document
 Inherited
DOM 2 Core getElementsByTagNameNS(namespaceURI:DOMString, localName:DOMString):NodeList
Returns a NodeList of all the Elements with a given local name and namespace URI in document order.
Document
 Inherited
DOM 1 HTML getElemenyById(elementId:DOMString):Element
Returns the Element that has an ID attribute with the given value.
Document
 Inherited
DOM 3 Core getFeature(feature:DOMString, version:DOMString):DOMObject
This method returns a specialized object which implements the specialized APIs of the specified feature and version, as specified in DOM Features.
Node
 Inherited
This method is used to retrieve the override style declaration for a specified element and a specified pseudo-element.
Document
  
Return the contents of selected text in the current document.
HTMLDocument
 Inherited
Retrieves the object associated to a key on a this node.
Node
 Inherited
DOM 2 Core hasAttributes():Boolean
Returns a boolean value of true or false, indicating if the current element has any attributes or not.
Node
 Inherited
DOM 1 Core hasChildNodes():Boolean
Returns a value that indicates whether the object has children.
Node
  
HTML 5 hasFocus():Boolean
The hasFocus method returns true if the focus is currently located anywhere inside the specified document.
HTMLDocument
 Inherited
DOM 2 Core importNode(importedNode:Node, deep:Boolean):Node
Imports a node from another document to this document, without altering or removing the source node from the original document; this method creates a new copy of the source node.
Document
 Inherited
DOM 1 Core insertBefore(newNode:Node, childNode:Node):Node
Inserts the specified node before a reference element as a child of the current node.
Node
 Inherited
DOM 3 Core isDefaultNamespace(namespaceURI:DOMString):Boolean
Returns true if the namespace is the default namespace on the given node or false if not.
Node
 Inherited
DOM 3 Core isEqualNode(arg:Node):Boolean
Tests whether two nodes are equal.
Node
 Inherited
DOM 3 Core isSameNode(other:Node):Boolean
Returns whether this node is the same node as the given one.
Node
 Inherited
DOM 2 Core isSupported(feature:DOMString, version:DOMString):Boolean
Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.
Node
 Inherited
DOM 3 Load and Save Obsolete load(uri:DOMString):Boolean
Replaces the content of the document with the result of parsing the given URI.
Document
 Inherited
DOM 3 Load and Save Obsolete loadXML(source:DOMString):Boolean
Replace the content of the document with the result of parsing the input string, this method is always synchronous.
Document
 Inherited
Takes a prefix and returns the namespaceURI associated with it on the given node if found (and null if not).
Node
 Inherited
DOM 3 Core lookupPrefix(namespaceURI:DOMString):DOMString
Returns the prefix for a given namespaceURI if present, and null if not.
Node
 Inherited
DOM 1 Core normalize():void
Puts the specified node and all of its subtree into a "normalized" form.
Node
 Inherited
DOM 3 Core normalizeDocument():void
This method acts as if the document was going through a save and load cycle, putting the document in a "normal" form.
Document
  
DOM 1 HTML open(url:DOMString, name:DOMString, features:DOMString, replace:Boolean):*
Open a document stream for writing.
HTMLDocument
  
Non-Standard queryCommandEnabled(cmdId:DOMString):Boolean
Determines whether the given command can be executed on the document in its current state.
HTMLDocument
  
Non-Standard queryCommandIndeterm(cmdId:DOMString):Boolean
Determines whether the current selection is in an indetermined state.
HTMLDocument
  
Non-Standard queryCommandState(cmdId:DOMString):Boolean
Determines whether the given command has been executed on the current selection.
HTMLDocument
  
Non-Standard queryCommandSupported(cmdId:DOMString):Boolean
Returns a Boolean value that indicates whether the current command is supported on the current range.
HTMLDocument
  
Non-Standard queryCommandText(cmdId:DOMString):DOMString
Retrieves the string associated with a command.
HTMLDocument
  
Non-Standard queryCommandValue(cmdId:DOMString):*
Determines the current value of the document, range, or current selection for the given command.
HTMLDocument
 Inherited
Selectors API querySelector(selectors:DOMString):Element
Returns the first element that is a descendent of the element on which it is invoked that matches the specified group of selectors.
Document
 Inherited
Selectors API querySelectorAll(selectors:DOMString):NodeList
Returns a list of all elements descended from the element on which it is invoked that match the specified group of selectors.
Document
  
Non-Standard recalc(forceAll:Boolean):void
Recalculates all dynamic properties in the current document.
HTMLDocument
  
Non-Standard releaseCapture():void
Removes mouse capture from the object in the current document.
HTMLDocument
  
Non-Standard Obsolete releaseEvents(eventTypeList:DOMString):void
The opposite of document.captureEvents( ), this method turns off event capture at the document level for one or more specific events named in the parameter list.
HTMLDocument
 Inherited
DOM 1 Core removeChild(node:Node):Node
Removes a child node from the object.
Node
 Inherited
DOM 2 Events removeEventListener(type:DOMString, listener:EventListener, useCapture:Boolean):void
Removes an event listener.
Node
 Inherited
DOM 3 Events removeEventListenerNS(namespaceURI:DOMString, type:DOMString, listener:EventListener, useCapture:Boolean):void
Removes an event listener.
Node
  
Non-Standard removeNode(removeChildren:Boolean = false):Node
Removes the object from the document hierarchy.
HTMLDocument
 Inherited
DOM 3 Core renameNode(n:Node, namespaceURI:DOMString, qualifiedName:DOMString):Node
Rename an existing node of type ELEMENT_NODE or ATTRIBUTE_NODE.
Document
 Inherited
DOM 1 Core replaceChild(newNode:Node, childNode:Node):Node
Replaces an existing child element with a new child element.
Node
  
Non-Standard replaceNode(newNode:Node):Node
Replaces the object with another element.
HTMLDocument
  
Non-Standard Obsolete routeEvent(event:Event):void
Used inside an event handler function, this method lets the event pass to its intended target object.
HTMLDocument
 Inherited
DOM 3 Load and Save Obsolete saveXML(snode:Node):DOMString
Save the document or the given node to a string (i.e.
Document
 Inherited
Non-Standard selectNodes(queryString:DOMString):NodeList
Applies the specified pattern-matching operation to this node's context and returns the list of matching nodes as IXMLDOMNodeList.
Node
 Inherited
Non-Standard selectSingleNode(queryString:DOMString):Node
Applies the specified pattern-matching operation to this node's context and returns the first matching node.
Node
 Inherited
Associate an object to a key on this node.
Node
  
Non-Standard swapNode(node:Node):Node
Exchanges the location of two objects in the document hierarchy.
HTMLDocument
 Inherited
Non-Standard transformNode(styleSheet:Node):DOMString
Processes this node and its children using the supplied Extensible Stylesheet Language Transformations (XSLT) style sheet and returns the resulting transformation.
Node
 Inherited
Non-Standard transformNodeToObject(styleSheet:Node, outputObject:*):void
Processes this node and its children using the supplied Extensible Stylesheet Language Transformations (XSLT) style sheet and returns the resulting transformation.
Node
 Inherited
Non-Standard updateSettings():void
Allows updating the print settings for the page.
Document
  
DOM 1 HTML write(text:DOMString):void
Write a string of text to a document stream opened by open().
HTMLDocument
  
DOM 1 HTML writeln(text:DOMString):void
Write a string of text followed by a newline character to a document stream opened by open().
HTMLDocument
Events
 Event Summary Defined By
 InheritedThis is a general event for notification of all changes to the document.Document
 InheritedThe DOM Implementation finishes loading the resource (such as the document) and any dependent resources (such as images, style sheets, or scripts).Document
 InheritedA mouse wheel has been rotated.Document
 InheritedA mouse wheel has been rotated around the y-axis.Document
 InheritedIs fired when the browser switches between online and offline mode.Document
 InheritedIs fired when the browser switches between online and offline mode.Document
 InheritedA document view or an element has been resized.Document
 InheritedA document view or an element has been scrolled.Document
 InheritedThe DOM implementation removes from the environment the resource (such as the document) or any dependent resources (such as images, style sheets, scripts).Document
Public Constants
 ConstantDefined By
 InheritedDOM 1 Core ATTRIBUTE_NODE : Number = 2
[static] The node is an Attr.
Node
 InheritedDOM 1 Core CDATA_SECTION_NODE : Number = 4
[static] The node is a CDATASection.
Node
 InheritedDOM 1 Core COMMENT_NODE : Number = 8
[static] The node is a Comment.
Node
 InheritedDOM 1 Core DOCUMENT_FRAGMENT_NODE : Number = 11
[static] The node is a DocumentFragment.
Node
 InheritedDOM 1 Core DOCUMENT_NODE : Number = 9
[static] The node is a Document.
Node
 InheritedDOM 3 Core DOCUMENT_POSITION_CONTAINED_BY : Number = 16
[static] The node is contained by the reference node.
Node
 InheritedDOM 3 Core DOCUMENT_POSITION_CONTAINS : Number = 8
[static] The node contains the reference node.
Node
 InheritedDOM 3 Core DOCUMENT_POSITION_DISCONNECTED : Number = 1
[static] The two nodes are disconnected.
Node
 InheritedDOM 3 Core DOCUMENT_POSITION_FOLLOWING : Number = 4
[static] The node follows the reference node.
Node
 InheritedDOM 3 Core DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC : Number = 32
[static] The determination of preceding versus following is implementation-specific.
Node
 InheritedDOM 3 Core DOCUMENT_POSITION_PRECEDING : Number = 2
[static] The second node precedes the reference node.
Node
 InheritedDOM 1 Core DOCUMENT_TYPE_NODE : Number = 10
[static] The node is a DocumentType.
Node
 InheritedDOM 1 Core ELEMENT_NODE : Number = 1
[static] The node is an Element.
Node
 InheritedDOM 1 Core ENTITY_NODE : Number = 6
[static] The node is an Entity.
Node
 InheritedDOM 1 Core ENTITY_REFERENCE_NODE : Number = 5
[static] The node is an EntityReference.
Node
 InheritedDOM 1 Core NOTATION_NODE : Number = 12
[static] The node is a Notation.
Node
 InheritedDOM 1 Core PROCESSING_INSTRUCTION_NODE : Number = 7
[static] The node is a ProcessingInstruction.
Node
 InheritedDOM 1 Core TEXT_NODE : Number = 3
[static] The node is a Text node.
Node
Property Detail
HTML 5 activeElementproperty
activeElement:Element  [read-only]

Introduced in: HTML 5 

Returns the currently focused element.

If no element in the Document is focused, this will return the body element.

Note: This attribute is part of the in-development HTML 5 specification.

Note (IE): For versions of Microsoft Internet Explorer 5 and later, the activeElement property is not defined until a document is loaded. A value of null is given for this property, if it is accessed inline during the loading of a document. This property can be accessed in the onload event handler function.

Note (IE): Internet Explorer 4.0 returns body as the activeElement when it is accessed inline during the loading of a document.


Implementation
    public function get activeElement():Element

See also

alinkColorproperty 
alinkColor:DOMString

Introduced in: DOM 0 

Deprecated since DOM Level 2 HTML

Returns or sets the color of an active link in the document body. A link is active during the time between mousedown and mouseup events.

Note: The color is a string representing the color as a word (e.g., "red") or hexadecimal value (e.g., "#ff0000").

Note: Gecko supports both alinkColor/:active and :focus . Internet Explorer 6 and 7 support alinkColor/:active only for HTML anchor (<a>) links and the behavior is the same as :focus under Gecko. There is no support for :focus in IE.

The default value is "#0000FF" for IE / "#EE0000" for Mozilla.


Implementation
    public function get alinkColor():DOMString
    public function set alinkColor(value:DOMString):void

See also

allproperty 
all:HTMLCollection  [read-only]

Non-standard (Microsoft)

Returns a reference to the collection of elements contained by the object.

Note: The all collection includes one element object for each valid HTML tag. If a valid tag has a matching end tag, both tags are represented by the same element object.

Note: The collection returned by the document's all collection always includes a reference to the HTML, HEAD, and TITLE objects regardless of whether the tags are present in the document. If the BODY tag is not present, but other HTML tags are, a BODY object is added to the all collection.

Note: If the document contains invalid or unknown tags, the collection includes one element object for each. Unlike valid end tags, unknown end tags are represented by their own element objects. The order of the element objects is the HTML source order. Although the collection indicates the order of tags, it does not indicate hierarchy.

Note: The name property only applies to some elements such as form elements. If the vIndex is set to a string matching the value of a name property in an element that the name property does not apply, then that element will not be added to the collection.


Implementation
    public function get all():HTMLCollection

See also


Example
This example, in Microsoft JScript (compatible with ECMA 262 language specification), shows how to display the names of all tags in the document in the order the tags appear in the document.
         for(i = 0; i < document.all.length; i++) {
             alert(document.all(i).tagName);
         }
DOM 1 HTML anchorsproperty 
anchors:HTMLCollection  [read-only]

Introduced in: DOM 1 HTML 

A collection of all the anchor (A) elements in a document with a value for the name attribute.

Note: For reasons of backwards compatibility, the returned set of anchors only contains those anchors created with the name attribute, not those created with the id attribute.


Implementation
    public function get anchors():HTMLCollection

See also


Example
         if ( document.anchors.length >= 5 ) {
             dump("dump found too many anchors");
             window.location = "http://www.google.com";
         }
DOM 1 HTML appletsproperty 
applets:HTMLCollection  [read-only]

Introduced in: DOM 1 HTML 

A collection of all the OBJECT elements that include applets and APPLET (deprecated) elements in a document.


Implementation
    public function get applets():HTMLCollection

See also


Example
         // ( When you know the second applet is the one you want ) 
         my_java_app = document.applets[1];
backgroundproperty 
background:DOMString

Introduced in: DOM 0 

Deprecated since DOM Level 2 HTML

URI of the background texture tile image.


Implementation
    public function get background():DOMString
    public function set background(value:DOMString):void
baseURIObjectproperty 
baseURIObject:nsIURI  [read-only]

Non-standard (Mozilla)

baseURIObject returns the nsIURI object representing the document's URI.

Note (Mozilla): This property exists on all nodes (HTML, XUL, SVG, MathML, etc.), but only if the script trying to use it has UniversalXPConnect privileges.

Note (Mozilla): This property may only be accessed from privileged code.


Implementation
    public function get baseURIObject():nsIURI

See also

bgColorproperty 
bgColor:DOMString

Introduced in: DOM 0 

Deprecated since DOM Level 2 HTML

Gets/sets the background color of the current document.

Note: The color is a string representing the color as a word (e.g., "red") or hexadecimal value (e.g., "#ff0000").

The default value is "#ffffff".


Implementation
    public function get bgColor():DOMString
    public function set bgColor(value:DOMString):void

See also

DOM 1 HTML bodyproperty 
body:HTMLElement

Introduced in: DOM 1 HTML 

The element that contains the content for the document. In documents with BODY contents, returns the BODY element. In frameset documents, this returns the outermost FRAMESET element.

Note: Though body is settable, setting a new body on a document will effectively remove all the current children of the existing </body> element.


Implementation
    public function get body():HTMLElement
    public function set body(value:HTMLElement):void

See also


Example
         // in HTML: <body id="oldBodyElement"></body>
         alert(document.body.id); // "oldBodyElement"
         var aNewBodyElement = document.createElement("body");
         aNewBodyElement.id = "newBodyElement";
         document.body = aNewBodyElement;
         alert(document.body.id); // "newBodyElement"
DOM 0 characterSetproperty 
characterSet:DOMString

Returns the character encoding of the current document.

Note: The character encoding is the character set used for rendering the document, which may be different from the encoding specified by the page (the user can override the encoding).


Implementation
    public function get characterSet():DOMString
    public function set characterSet(value:DOMString):void

See also

HTML 5 charsetproperty 
charset:DOMString

Introduced in: Non-Standard 
Modified in: HTML 5 

Sets or retrieves the character set used to encode the object.

Note (IE): In Microsoft Internet Explorer 6, This property now applies to the a, link, and script objects.


Implementation
    public function get charset():DOMString
    public function set charset(value:DOMString):void

See also

compatibleproperty 
compatible:HTMLCollection  [read-only]

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a

Non-standard (Microsoft)

Retrieves the collection of user agents and versions declared in the X-UA-Compatible meta tag.

Note (IE): This method is available in all compatibility modes.


Implementation
    public function get compatible():HTMLCollection

See also


Example
The following script iterates through the collection of compatible user agents, and displays each on a separate line.
         <meta http-equiv="X-UA-Compatible" content="IE=8;FF=3;OtherUA=4" />
         
         <script type="text/javascript">
         window.attachEvent('onload',function(e) {
         var a = [];
         var compat = document.compatible;
         for (var i=0; i<compat.length; i++) {
         a.push(compat[i].userAgent + '=' + compat[i].version);
         }
         var o = document.getElementById('output');
         o.innerHTML = a.join('<br/>');
         });
         </script>
         
         <div id="output"></div>
HTML 5 compatModeproperty 
compatMode:DOMString

Introduced in: Non-Standard 
Modified in: HTML 5 

Indicates whether the document is rendered in Quirks mode or Strict mode.

Note: Can either be "BackCompat" for Quirks mode or "CSS1Compat" for Strict mode.

Note: There is a third mode, Gecko's "Almost_Standards" Mode, which only differs from Strict mode in the layout of images inside table cells. This third mode is reported the same way as Strict mode: "CSS1Compat".

Note (IE): The compatMode property is deprecated in Internet Explorer 8 in favor of the documentMode property.


Implementation
    public function get compatMode():DOMString
    public function set compatMode(value:DOMString):void

See also


Example
         if (document.compatMode == "BackCompat") {
             // use some quirky stuff
         }
contentTypeproperty 
contentType:DOMString  [read-only]

Non-standard (Mozilla)

Returns the Content-Type from the HTTP headers of the document.

Note (Mozilla): The property returns the MIME property "Content-Type" set in the HTTP Header and not the META property set in the HEAD section of the document.


Implementation
    public function get contentType():DOMString

See also

DOM 0 cookieproperty 
cookie:DOMString

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in: DOM 0 
Modified in: DOM 1 HTML 

Get and set the cookies associated with the current document.

allCookies = document.cookie;

allCookies is a string containing a semicolon-separated list of cookies (i.e. key=value pairs)

document.cookie = updatedCookie;

updatedCookie is a string of form key=value. Note that you can only set/update a single cookie at a time using this method.

Any of the following cookie attribute values can optionally follow the key-value pair, specifying the cookie to set/update, and preceded by a semi-colon separator:

Note: The cookie value string can use encodeURIComponent() to ensure that the string does not contain any commas, semicolons, or whitespace (which are disallowed in cookie values).


Implementation
    public function get cookie():DOMString
    public function set cookie(value:DOMString):void

Throws
DOMException — SYNTAX_ERR: If the new value does not adhere to the cookie syntax.

See also


Example
         document.cookie = "name=oeschger";
         document.cookie = "favorite_food=tripe";
         alert(document.cookie);
         // displays: name=oeschger;favorite_food=tripe
HTML 5 defaultCharsetproperty 
defaultCharset:DOMString  [read-only]

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in: Non-Standard 
Modified in: HTML 5 

Gets the default character set from the current regional language settings.

Note (Microsoft): The value depends on the current regional language settings. For typical settings in North America, the value is windows-1252.


Implementation
    public function get defaultCharset():DOMString

See also

designModeproperty 
designMode:DOMString

Non-standard (Microsoft/Mozilla)

Sets or gets a value that indicates whether the document can be edited.

Values can be:

Note (Mozilla): Gets/sets WYSYWIG editing capability of Midas. It can only be used for HTML documents.

Note (Mozilla): Midas is the code name for Gecko's built-in rich text editor. Midas can be enabled via JavaScript on an HTML document. When Midas is enabled, the document becomes editable by the user. Scripting for Midas is based on the DHTML commands supported by Internet Explorer.

Note (Microsoft): You can use the designMode property to put Windows Internet Explorer into a mode so that you can edit the current document.

Note (Microsoft): While the browser is in design mode, objects enter a UI-activated state when the user presses ENTER, clicks an object that has focus, or double-clicks the object. Objects that are UI-activated have their own window in the document. You can modify the UI only when the object is in a UI-activated state.

Note (Microsoft): You cannot execute script when the value of the designMode property is set to On.

Note: Since an entire document becomes editable, authors often load the editable document into an IFRAME and do the bulk of the scripting in the parent document.


Implementation
    public function get designMode():DOMString
    public function set designMode(value:DOMString):void

See also


Example
         <html>
             <head>
                 <title>Simple Edit Box</title>
             </head>
             <body>
         
                 <iframe
                     id="MidasForm"
                     src="about:blank"
                     onload="this.contentDocument.designMode='on';"
                 ></iframe>
             </body>
         </html>
dirproperty 
dir:DOMString

Non-standard (Microsoft/Mozilla)

Sets or retrieves a value that indicates the reading order of the object.

Values can be:

Note: The dir property does not affect alphanumeric characters in Latin documents. These characters always render ltr. However, the property does affect punctuation characters in Latin documents. For example, punctuation marks such as periods and question marks will render to the left of a sentence when the dir property is set to rtl.

Note: The value of dir property has no effect on the orientation of coordinates for an object's positioning properties. For example, the left property and the right property perform the same placement in both cases. However, when both the left and right properties are specified, the left property takes precedence when the dir property is set to ltr. Likewise, the right property takes precedence when the dir property is set to rtl.


Implementation
    public function get dir():DOMString
    public function set dir(value:DOMString):void

See also

documentModeproperty 
documentMode:Number  [read-only]

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a

Non-standard (Microsoft)

Retrieves the document compatibility mode of the document.

Possible Values:

Note (IE): The document compatibility mode of a Web page determines how Internet Explorer 8 interprets and renders the page. Page authors generally use meta elements to specify X-UA-Compatible HTTP-EQUIV headers that specify the document compatibility mode. For more information, see Defining Document Compatibility. In versions of Internet Explorer previous to Internet Explorer 8, compatMode was solely determined by DOCTYPE.


Implementation
    public function get documentMode():Number

See also

documentURIObjectproperty 
documentURIObject:nsIURI  [read-only]

Non-standard (Mozilla)

Returns an nsIURI object representing the URI of the document.

This only works for privileged (UniversalXPConnect) scripts, including extension code. For web content this property doesn't have any special meaning and can be used just like any other custom property.

Privileged code must be careful not to try getting or setting this property on a non-wrapped content object (e.g. on a wrappedJSObject of an XPCNativeWrapper). See bug 324464's comments for details.


Implementation
    public function get documentURIObject():nsIURI

See also


Example
         // Check that the URI scheme of the current tab in Firefox is 'http',
         // assuming this code runs in context of browser.xul
         var uriObj = content.document.documentURIObject;
         var uriPort = uriObj.port;
         
         if (uriObj.schemeIs('http')) {
             ...
         }
DOM 1 HTML domainproperty 
domain:DOMString

Introduced in: DOM 1 HTML 

Gets/sets the domain of the current document.

Note: This property returns null if the domain of the document cannot be identified.

Note: In the DOM HTML specification, this property is listed as being read-only. However, all common browsers including Mozilla will let you set it to a superdomain of the current value. For example, on developer.mozilla.org it is possible to set it to "mozilla.org" but not "mozilla.com".

Note: It is not universally possible in all browsers to set document.domain to a top-level domain (such as "com" or "org") or to a subdomain of a domain on which registrations are restricted (e.g. "co.uk", as registrations on the "uk" domain are restricted).


Implementation
    public function get domain():DOMString
    public function set domain(value:DOMString):void

See also


Example
         // for document www.love.com/good.html,
         // this script closes the window
         var badDomain = "www.love.com";
         if (document.domain == badDomain) {
             window.close();
         }
         // For the URI http://developer.mozilla.org/en/docs/DOM the
         // following sets domain to the string "developer.mozilla.org"
         var domain = document.domain;
DOM 0 embedsproperty 
embeds:HTMLCollection  [read-only]

Introduced in: DOM 0 

Retrieves a collection of all embed objects in the document.


Implementation
    public function get embeds():HTMLCollection

See also

expandoproperty 
expando:Boolean

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a

Non-standard (Microsoft)

Sets or retrieves a value indicating whether arbitrary variables can be created within the object.

Note: You can extend the properties on an object by creating arbitrary properties with values. You should be careful, however, because you can unintentionally set a property value when scripting in a case-sensitive language such as Microsoft JScript. For example, if the property value is borderColor and you type the value "bordercolor = 'blue'", you have, in fact, created another property on the style object called bordercolor with the value 'blue'. If you query the value of the property, the value "blue" is returned. However, the borders for the element do not turn blue.

Note: Setting the expando property of the document object to false precludes the functionality of all expandos within the document.

The default value is true.


Implementation
    public function get expando():Boolean
    public function set expando(value:Boolean):void

See also


Example
The following example demonstrates that, by setting the expando property of the document object to false, the document ignores the UNSELECTABLE expando on the span and allows you to select the text.
         <html>
         
         <head>
         <script type="text/javascript">
             //Set the expando property to false.
             document.expando = false;
         </script>
         </head>
         
         <body>
         
         <div>
         <span id="oSpan" unselectable="on">This text should be selectable.</span>
         </div>
         
         </body>
         
         </html>
fgColorproperty 
fgColor:DOMString

Introduced in: DOM 0 

Deprecated since DOM Level 2 HTML

Gets/sets the foreground color, or text color, of the current document.

Note: The color is a string representing the color as a word (e.g., "red") or hexadecimal value (e.g., "#ff0000").

The default value is "#000000".


Implementation
    public function get fgColor():DOMString
    public function set fgColor(value:DOMString):void

See also

fileCreatedDateproperty 
fileCreatedDate:DOMString  [read-only]

Non-standard (Microsoft)

Retrieves the date the file was created. For example, Monday, December 08, 1997.


Implementation
    public function get fileCreatedDate():DOMString

See also


Example
This example implements the fileCreatedDate property to count the number of days since the document was created.
         // Date document was created
         var oCreated=new Date(document.fileCreatedDate);
         
         // Today's Date
         var oToday=new Date();
         
         //There are 86400000 milliseconds in a day
         var iMilliSeconds=86400000;
         var iDaysBetween=(oToday.getTime() - oCreated.getTime()) / iMilliSeconds;    
         
         alert("Created: " + oCreated + "\nDays since created: " + parseInt(iDaysBetween));
fileModifiedDateproperty 
fileModifiedDate:DOMString  [read-only]

Non-standard (Microsoft)

Retrieves the date the file was last modified. For example, Monday, December 08, 1997.


Implementation
    public function get fileModifiedDate():DOMString

See also

fileSizeproperty 
fileSize:DOMString  [read-only]

Non-standard (Microsoft)

Retrieves the file size.


Implementation
    public function get fileSize():DOMString

See also

DOM 1 HTML formsproperty 
forms:HTMLCollection  [read-only]

Introduced in: DOM 1 HTML 

A collection of all the forms of a document.


Implementation
    public function get forms():HTMLCollection

See also


Example
         <html>
         
         <head>
             <title> document.forms example</title>
         </head>
         
         <body>
         <form id="robby">
             <input type="button" onclick="alert(document.forms[0].id);" value="robby's form" />
         </form>
         
         <form id="dave">
             <input type="button" onclick="alert(document.forms[1].id);" value="dave's form" />
         </form>
         
         <form id="paul">
             <input type="button" onclick="alert(document.forms[2].id);" value="paul's form" />
         </form>
         
         </body>
         </html>
framesproperty 
frames:HTMLCollection  [read-only]

Non-standard (Microsoft)

Retrieves a collection of all window objects defined by the given document or defined by the document associated with the given window.


Implementation
    public function get frames():HTMLCollection

See also

DOM 0 heightproperty 
height:Number

Introduced in: DOM 0 

Returns the height of the body element of the current document.


Implementation
    public function get height():Number
    public function set height(value:Number):void

See also


Example
         // alert document height
         alert(document.height);
DOM 1 HTML imagesproperty 
images:HTMLCollection  [read-only]

Introduced in: DOM 1 HTML 

A collection of all the IMG elements in a document. The behavior is limited to IMG elements for backwards compatibility.

Note: As suggested by HTML 4.01, to include images, authors may use the OBJECT element or the IMG element. Therefore, it is recommended not to use this attribute to find the images in the document but getElementsByTagName with HTML 4.01 or getElementsByTagNameNS with XHTML 1.0.


Implementation
    public function get images():HTMLCollection

See also


Example
         var ilist = document.images;
         for(var i = 0; i < ilist.length; i++) {
             if(ilist[i] == "banner.gif") {
                 // found the banner
             }
         }
DOM 0 lastModifiedproperty 
lastModified:DOMString  [read-only]

Introduced in: DOM 0 

Returns a string containing the date and time on which the current document was last modified, in the form "MM/DD/YY hh:mm:ss".

Note: As a string, lastModified cannot easily be used for comparisions between the modified dates of documents.


Implementation
    public function get lastModified():DOMString

See also


Example
         dump(document.lastModified); 
         // returns: Tuesday, July 10, 2001 10:19:42
linkColorproperty 
linkColor:DOMString

Introduced in: DOM 0 

Deprecated since DOM Level 2 HTML

Gets/sets the color of links within the document.

Note: The color is a string representing the color as a word (e.g., "red") or hexadecimal value (e.g., "#ff0000").

The default value is "#0000FF" for IE / "#0000EE" for Mozilla.


Implementation
    public function get linkColor():DOMString
    public function set linkColor(value:DOMString):void

See also

DOM 1 HTML linksproperty 
links:HTMLCollection  [read-only]

Introduced in: DOM 1 HTML 

A collection of all AREA elements and anchor (A) elements in a document with a value for the href attribute.


Implementation
    public function get links():HTMLCollection

See also


Example
         var links = document.links;
         for(var i = 0; i < links.length; i++) {
             var linkHref = document.createTextNode(links[i].href);
             var lineBreak = document.createElement("br");
             document.body.appendChild(linkHref);
             document.body.appendChild(lineBreak);
         }
DOM 0 locationproperty 
location:Location  [read-only]

Introduced in: DOM 0 

Returns a Location object, which contains information about the URL of the document and provides methods for changing that URL. In Gecko browsers you can also assign to this property to load another URL.

Note: Location objects have a toString method returning the current URL. You can also assign a string to document.location. This means that you can work with document.location as if it were a string in most cases. Sometimes, for example when you need to call a String method on it, you have to explicitly call toString:

alert(document.location.toString().charAt(17))

Note: document.location was originally a read-only property, although Gecko browsers allow you to assign to it as well. For cross-browser safety, use window.location instead.

Note: To retrieve just the URL as a string, the read-only document.URL property can be used.


Implementation
    public function get location():Location

See also


Example
         dump(document.location); 
         // Prints a string like
         // "http://www.example.com/juicybits.html" to the console
namespacesproperty 
namespaces:HTMLCollection  [read-only]

Non-standard (Microsoft)

Retrieves a collection of namespace objects. INCOMPLETE


Implementation
    public function get namespaces():HTMLCollection

See also

parentWindowproperty 
parentWindow:Window  [read-only]

Non-standard (Microsoft)

Gets a reference to the container object of the window.


Implementation
    public function get parentWindow():Window

See also

DOM 0 pluginsproperty 
plugins:HTMLCollection  [read-only]

Introduced in: DOM 0 

Returns an HTMLCollection object containing one or more HTMLEmbedElements or null which represent the <embed> elements in the current document.

Note: For a list of installed plugins, use navigator.plugins instead.


Implementation
    public function get plugins():HTMLCollection

See also

protocolproperty 
protocol:DOMString

Non-standard (Microsoft)

Sets or retrieves the protocol portion of a URL.

Note: The protocol property specifies how to transfer information from the host to the client. Windows Internet Explorer supports several predefined protocols, including http and ftp.

Note: The document, img, and location objects expose the protocol property as read-only. location.protocol property returns the initial substring of a URL, including the first colon (for example, http:). However, document.protocol returns the expanded text of the protocol acronym. For example, it returns the http protocol as Hypertext Transfer Protocol.


Implementation
    public function get protocol():DOMString
    public function set protocol(value:DOMString):void

See also


Example
This example function returns the protocol property of the current page location.
         function getProtocol() {
             return document.location.protocol;
         }
HTML 5 readyStateproperty 
readyState:DOMString  [read-only]

Introduced in: Non-Standard 
Modified in: HTML 5 

Retrieves a value that indicates the current state of the object.

StateDescription
uninitializedObject is not initialized with data.
loadingObject is loading its data.
loadedObject has finished loading its data.
interactiveUser can interact with the object even though it is not fully loaded.
completeObject is completely initialized.

Note: An object's state is initially set to uninitialized, and then to loading. When data loading is complete, the state of the link object passes through the loaded and interactive states to reach the complete state.

Note: The states through which an object passes are determined by that object; an object can skip certain states (for example, interactive) if the state does not apply to that object.

Note: Data source objects and databound elements are normally populated asynchronously, and certain programmatic operations can only be performed reliably on databound objects when they are ready for use. Therefore, the appropriate code should be written to confirm the readyState of objects prior to performing certain operations on them. For example, walking the rows of a table should not be attempted until after the table has reached the complete state.

Note: The readyState property enables the status of an object to be tested. The correct place to test the readyState property is in the event handler for onreadystatechange. Similarly, a data source object (DSO) fires the ondatasetcomplete event to notify the Web page that the dataset is ready for programmatic operation.


Implementation
    public function get readyState():DOMString

See also

DOM 1 HTML referrerproperty 
referrer:DOMString  [read-only]

Introduced in: DOM 1 HTML 

Returns the URI of the page that linked to this page. The value is an empty string if the user navigated to the page directly (not through a link, but, for example, via a bookmark).

Note: This property returns a value only when the user reaches the current page through a link from the previous page. Otherwise, document. referrer returns an empty string; it also returns an empty string when the link is from a secure site.

Note: For example, if PageA.htm includes a link to PageB.htm, and the user clicks that link, the document.referrer on PageB.htm returns "PageA.htm." However, if the user is on PageA.htm and types PageB.htm into the address line or chooses the Open command from the File menu to get to PageB.htm, the document.referrer returns an empty string.


Implementation
    public function get referrer():DOMString

See also

HTML 5 scriptsproperty 
scripts:HTMLCollection  [read-only]

Introduced in: Non-Standard 
Modified in: HTML 5 

Returns an HTMLCollection object containing one or more HTMLScriptElements or null which represent the <script> elements in the current document.


Implementation
    public function get scripts():HTMLCollection

See also

selectionproperty 
selection:Selection  [read-only]

Non-standard (Microsoft)

Represents the active selection, which is a highlighted block of text or other elements in the document that a user or a script can carry out some action on.

Note (IE): You can use the selection object as input from the user to identify which portion of the document to act on, or as output to the user to show the results of an action.

Note (IE): Users and scripts can create selections. Users create selections by dragging the mouse over a portion of the document. Scripts create selections by calling the select method on a text range or similar object. To get the active selection, apply the selection keyword to the document object. To carry out work on a selection, create a text range object from the selection using the createRange method.

Note: A document can have only one selection at a time. The selection has a type that determines whether it is empty or contains a block of text or elements. Although an empty selection contains nothing, you can use it to mark a position in the document.


Implementation
    public function get selection():Selection

See also

DOM 1 HTML titleproperty 
title:DOMString

Introduced in: DOM 1 HTML 

Gets or sets the title of the document.

Note: The initial value of document.title is the text content of the <title> element.


Implementation
    public function get title():DOMString
    public function set title(value:DOMString):void

See also


Example
         <html>
         <head>
             <title>Hello World!</title> 
         </head>
         <body>
             <script>
                 alert(document.title); // displays "Hello World!"
                 document.title = "Goodbye World!";
                 alert(document.title); // displays "Goodbye World!"
             </script>
         </body>
         </html>
uniqueIDproperty 
uniqueID:DOMString  [read-only]

Non-standard (Microsoft)

Retrieves an autogenerated, unique identifier for the object.

Note (IE): When you apply this property to the document object, the browser automatically generates a new ID that you can assign to an element's id property.

Note (IE): A new ID is generated and assigned to the element the first time the property is retrieved. Every subsequent access to the property on the same element returns the same ID.

Note (IE): The unique ID generated is not guaranteed to be the same every time the page is loaded.


Implementation
    public function get uniqueID():DOMString

See also


Example
This example uses the uniqueID property to show how the browser can autogenerate a unique ID for an element inserted into the page by a behavior.
         // Specifying an ID=document.uniqueID ensures that a unique identifier
         // will be assigned to the element being inserted into the page by
         // the behavior.
         newTextAreaID = element.document.uniqueID;
         element.document.body.insertAdjacentHTML ("beforeEnd",
         "");
DOM 1 HTML URLproperty 
URL:DOMString  [read-only]

Introduced in: DOM 1 HTML 

Returns the URL of the current document.

Note: URL is a replacement for the DOM Level 0 document.location.href property. However document.URL is not settable, unlike document.location.href.


Implementation
    public function get URL():DOMString

See also


Example
var currentURL = document.URL; alert(currentURL);
URLUnencodedproperty 
URLUnencoded:DOMString  [read-only]

Non-standard (Microsoft)

Gets the URL for the document, stripped of any character encoding.


Implementation
    public function get URLUnencoded():DOMString

See also


Example
The following illustrates the difference between the value returned by the URLUnencoded property and the value returned by the URL property of the document.
         <script>
         function window.onload() {
             oURL.innerText = document.URL;
             oURL2.innerText = document.URLUnencoded;
         }            
         </script>
vlinkColorproperty 
vlinkColor:DOMString

Introduced in: DOM 0 

Deprecated since DOM Level 2 HTML

Gets/sets the color of links that the user has visited in the document.

Note: The color is a string representing the color as a word (e.g., "red") or hexadecimal value (e.g., "#ff0000").

The default value is "#800080" for IE / "#551A8B" for Mozilla.


Implementation
    public function get vlinkColor():DOMString
    public function set vlinkColor(value:DOMString):void

See also

DOM 0 widthproperty 
width:Number

Introduced in: DOM 0 

Returns the width of the body element of the current document in pixels.

Note: Not supported by IE.


Implementation
    public function get width():Number
    public function set width(value:Number):void

See also


Example
         function init() {
             alert("The width of the document is " + document.width + " pixels.");
         }
XSLDocumentproperty 
XSLDocument:DOMObject  [read-only]

Non-standard (Microsoft)

Retrieves a reference to the top-level node of the Extensible Stylesheet Language (XSL) document.

Note (IE): You can use the XSLDocument property to access the Document Object Model (DOM) for the XSL style sheet. For more information, refer to the XML DOM overview.


Implementation
    public function get XSLDocument():DOMObject

See also


Example
This example uses the XSLDocument property to access the DOM for the XSL and change attributes representing sort keys.
         function sort(key) {
             // Find the "order-by" attributes in the style sheet.
             var s = document.XSLDocument.selectNodes("*/xsl:template[&64;match='menu']
                                                       //xsl:apply-templates/&64;order-by");
         
             // Replace the values with the new sort key.
             for (var i = s.nextNode(); i != null; i = s.nextNode()) {
                 i.value = key;
             }
         
             // Find the subset of the document we need to update.
             var d = document.XMLDocument.selectSingleNode("story/menu");
         
             // Apply the style sheet to the subset, and update the display.
             menu.innerHTML = d.transformNode(document.XSLDocument);
         }
Method Detail
Non-Standard Obsolete captureEvents()method
public function captureEvents(eventTypeList:DOMString):void

Non-standard (Mozilla)

Obsolete

Instructs the browser to grab events of a specific type before they reach their intended target document objects. The object invoking this method must then have event handlers defined for the given event types to process the event.

Parameters

eventTypeList:DOMString — A comma-separated list of case-sensitive event types as derived from the available Event object constants, such as Event.CLICK or Event.MOUSEMOVE.

See also

clear()method 
public function clear():void

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in: DOM 0 

Deprecated

This method used to clear the whole specified document in early (pre-1.0) versions of Mozilla.

In recent versions of Mozilla-based applications as well as in Internet Explorer and Netscape 4 this method does nothing.

See also

DOM 1 HTML close()method 
public function close():void

Introduced in: DOM 1 HTML 

Closes a document stream opened by open() and forces rendering.

See also


Example
         // open a document to write to it.
         // write the content of the document.
         // close the document.
         document.open();
         document.write("<p>The one and only content.</p>");
         document.close();
DOM 3 XPath createExpression()method 
public function createExpression(expression:DOMString, resolver:XPathNSResolver):XPathExpression

Introduced in: DOM 3 XPath 

Creates a parsed XPath expression with resolved namespaces. This is useful when an expression will be reused in an application since it makes it possible to compile the expression string into a more efficient internal form and preresolve all namespace prefixes which occur within the expression.

Note (Mozilla): Prior to Firefox 3, you could call this method on documents other than the one you planned to run the XPath against. Under Firefox 3, you must call it on the same document.

Parameters

expression:DOMString — The XPath expression string to be parsed.
 
resolver:XPathNSResolver — The resolver permits translation of all prefixes, including the xml namespace prefix, within the XPath expression into appropriate namespace URIs. If this is specified as null, any namespace prefix within the expression will result in DOMException being thrown with the code NAMESPACE_ERR.

Returns
XPathExpression — The compiled form of the XPath expression.

See also

DOM 3 XPath createNSResolver()method 
public function createNSResolver(nodeResolver:Node):XPathNSResolver

Introduced in: DOM 3 XPath 

Adapts any DOM node to resolve namespaces so that an XPath expression can be easily evaluated relative to the context of the node where it appeared within the document. This adapter works like the DOM Level 3 method lookupNamespaceURI on nodes in resolving the namespaceURI from a given prefix using the current information available in the node's hierarchy at the time lookupNamespaceURI is called. also correctly resolving the implicit xml prefix.

Note: XPath defines QNames without prefix to match only elements in the null namespace. There is no way in XPath to pick up the default namespace as applied to a regular element reference (e.g., p[&64;id='_myid'] for xmlns='http://www.w3.org/1999/xhtml'). To match default elements in a non-null namespace, you either have to refer to a particular element using a form such as *

Parameters

nodeResolver:Node — The node to be used as a context for namespace resolution.

Returns
XPathNSResolver — XPathNSResolver which resolves namespaces with respect to the definitions in scope for a specified node.

See also

DOM 3 XPath evaluate()method 
public function evaluate(expression:DOMString, contextNode:Node, resolver:XPathNSResolver, type:Number, result:DOMObject):DOMObject

Introduced in: DOM 3 XPath 

Evaluates an XPath expression string and returns a result of the specified type if possible.

Parameters

expression:DOMString — The XPath expression string to be parsed and evaluated.
 
contextNode:Node — The context is context node for the evaluation of this XPath expression. If the XPathEvaluator was obtained by casting the Document then this must be owned by the same document and must be a Document, Element, Attribute, Text, CDATASection, Comment, ProcessingInstruction, or XPathNamespace node. If the context node is a Text or a CDATASection, then the context is interpreted as the whole logical text node as seen by XPath, unless the node is empty in which case it may not serve as the XPath context.
 
resolver:XPathNSResolver — The resolver permits translation of all prefixes, including the xml namespace prefix, within the XPath expression into appropriate namespace URIs. If this is specified as null, any namespace prefix within the expression will result in DOMException being thrown with the code NAMESPACE_ERR.
 
type:Number — If a specific type is specified, then the result will be returned as the corresponding type. For XPath 1.0 results, this must be one of the codes of the XPathResult interface.
 
result:DOMObject — The result specifies a specific result object which may be reused and returned by this method. If this is specified as nullor the implementation does not reuse the specified result, a new result object will be constructed and returned. For XPath 1.0 results, this object will be of type XPathResult.

Returns
DOMObject — The result of the evaluation of the XPath expression. For XPath 1.0 results, this object will be of type XPathResult.

See also


Example
         var headings = document.evaluate("//h2", document, null, XPathResult.ANY_TYPE, null); 
         /* Search the document for all h2 elements.  
          * The result will likely be an unordered node iterator. */
         var thisHeading = headings.iterateNext(); 
         var alertText = "Level 2 headings in this document are:\n";
         while (thisHeading) {
             alertText += thisHeading.textContent + "\n";
             thisHeading = headings.iterateNext();
         }
         alert(alertText); // Alerts the text of all h2 elements
execCommand()method 
public function execCommand(aCommandName:DOMString, aShowDefaultUI:Boolean, aValueArgument:DOMString):Boolean

Non-standard (Microsoft/Mozilla)

When an HTML document has been switched to designMode, the document object exposes the execCommand method which allows one to run commands to manipulate the contents of the editable region. Most commands affect the document's selection (bold, italics, etc), while others insert new elements (adding a link) or affect an entire line (indenting). When using contentEditable, calling execCommand will affect the currently active editable element.

Parameters

aCommandName:DOMString — The name of the command
 
aShowDefaultUI:Boolean — Whether the default user interface should be shown. This is not implemented in Mozilla.
 
aValueArgument:DOMString — Some commands (such as insertimage) require an extra value argument (the image's url). Pass an argument of null if no argument is needed.

Returns
Boolean — True if successful, or an error value otherwise.

See also


Example
         //HTML:
         <button onclick="doRichEditCommand('bold')" style="font-weight:bold;">B</button>
         
         //JavaScript:
         function doRichEditCommand(aName, aArg){
             getIFrameDocument('editorWindow').execCommand(aName,false, aArg);
             document.getElementById('editorWindow').contentWindow.focus()
         }
execCommandShowHelp()method 
public function execCommandShowHelp(aCommandName:DOMString):Boolean

Non-standard (Microsoft/Mozilla)

Displays help information for the given command identifier.

Parameters

aCommandName:DOMString — Contains an identifier of a command. It can be any command identifier given in the list of Command Identifiers.

Returns
Boolean — True if successful, or an error value otherwise.

See also

fireEvent()method 
public function fireEvent(type:DOMString, event:Object = null):Boolean

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a

Non-standard (Microsoft)

Fires a specified event on the object.

If the event being fired cannot be cancelled, fireEvent always returns true.

Regardless of their values specified in the event object, the values of the four event properties—cancelBubble, returnValue, srcElement, and type—are automatically initialized to the values shown in the following table.

Parameters

type:DOMString — String that specifies the name of the event to fire.
 
event:Object (default = null) — Object that specifies the event object from which to obtain event object properties.

Returns
Boolean — Event fired successfully

See also

focus()method 
public function focus():void

Non-standard (Microsoft)

Causes the element to receive the focus and executes the code specified by the onfocus event.

Note (IE): This method raises the onfocus event. The effect depends on the object calling the method. When called for child windows (such as those created with the open method of a window object), focus brings the target window to the foreground.

Note (IE): Windows Internet Explorer 8 and later. The focus method no longer brings child windows (such as those created with the open method) to the foreground. Child windows now request focus from the user, usually by flashing the title bar. To directly bring the window to the foreground, add script to the child window that calls the focus method of its window object.

Note: Internet Explorer 7 and later. For security reasons, child windows will only respond to the focus method when the following conditions are true:

If any of these conditions are true, the child window ignores the focus event.

Note: As of Microsoft Internet Explorer 5, elements that expose the focus method must have the TABINDEX attribute set.

Note: Elements cannot receive focus until the document finishes loading.

See also

getBoxObjectFor()method 
public function getBoxObjectFor(element:Element):nsIBoxObject

Non-standard (Mozilla)

This particular method was a way for XUL elements to efficiently determine their position, amongst other things. A couple of years ago this feature started to be used by the general web-developer world. This was quickly realized to be a major mistake.

Parameters

element:Element — Target element

Returns
nsIBoxObject — The dimensions of the element

See also

HTML 5 getElementsByClassName()method 
public function getElementsByClassName(classNames:DOMString):NodeList

Introduced in: HTML 5 

Returns a set of elements with the given class name. When called on the document object, the complete document is searched, including the root node. You may also call getElementsByClassName on any element; it will return only elements under the specified root element with the given class name.

Parameters

classNames:DOMString — An unordered set of unique space-separated tokens representing classes.

Returns
NodeList — A live NodeList object containing all the elements in the document, in tree order, that have all the classes specified in that argument, having obtained the classes by splitting a string on spaces. If there are no tokens specified in the argument, then returns an empty NodeList.

See also


Example

Get all elements that have a class of 'test'

document.getElementsByClassName('test')

Get all elements that have a class of 'red' and 'test'

document.getElementsByClassName('red test')

Get all elements that have a class of 'test', inside of an element that has the ID of 'main'

document.getElementById('main').getElementsByClassName('test')

And if we go ahead and add in JavaScript 1.6's Array extras, we can do some really-cool matches.

Find all div elements that have a class of 'test'

         Array.filter( document.getElementsByClassName('test'), function(elem) {
             return elem.nodeName == 'DIV';
         });

Find all elements that have a class of 'test' (as do their parent element)

         var test = document.getElementsByClassName('test');
         Array.filter( test, function(elem){
             return Array.indexOf( test, elem.parentNode ) > -1;
         });
DOM 1 HTML getElementsByName()method 
public function getElementsByName(elementName:DOMString):NodeList

Introduced in: DOM 1 HTML 

Returns a list of elements with a given name in the (X)HTML document.

Parameters

elementName:DOMString — The name attribute value for an element.

Returns
NodeList — The matching elements.

See also


Example
// return some of the forms 
         //<form name="up"><input type="text"/></form> 
         //<form name="up"><input type="text"/></form> 
         //<form name="down"><input type="text"/></div> 
         //<form name="down"><input type="text"/></div> 
         
         up_forms = document.getElementsByName("up"); 
         dump(up_forms.item(0).tagName); // returns "div"
DOM 0 getSelection()method 
public function getSelection():DOMString

Introduced in: DOM 0 

Return the contents of selected text in the current document.

Returns
DOMString — The selected text

See also


Example
         <INPUT TYPE="BUTTON" NAME="selectString" VALUE="Show 
         any highlighted text" onClick="alert('The following text is 
         selected:\n'+document.getSelection());"> 
HTML 5 hasFocus()method 
public function hasFocus():Boolean

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in: HTML 5 

The hasFocus method returns true if the focus is currently located anywhere inside the specified document.

Returns
Boolean — Returns true if the document has focus; otherwise, returns false.

See also

DOM 1 HTML open()method 
public function open(url:DOMString, name:DOMString, features:DOMString, replace:Boolean):*

Introduced in: DOM 1 HTML 

Open a document stream for writing. If a document exists in the target, this method clears it.

Note (IE): All params are for IE only

Note: This method and the ones following allow a user to add to or replace the structure model of a document using strings of unparsed HTML. At the time of writing alternate methods for providing similar functionality for both HTML and XML documents were being considered.

Note (Mozilla): Also, an automatic document.open() call happens when document.write() is called after the page has loaded, but that's not defined in the W3C specification.

IE Style

Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.

Parameters

url:DOMString — When a new document is opened, url is a String that specifies a MIME type for the document. When a new window is opened, url is a String that specifies the URL to render in the new window. If a url is not specified, a new window with about:blank is displayed.
 
name:DOMString — Optional. When a new document is opened, specify the String replace for name to specify that the new document replaces the current document in the history list. If the replace value is not specified when you open a document, a new entry is added to the history list. When a window is opened, this is a String that specifies the name of the window. The value of this parameter can be specified as the value of the TARGET attribute for a form or an a element. This value defines this new window as the location to load a document.
ValueDescription
replaceThis value is only used to open a new document, and specifies that the new document replaces the current entry in the history list.
_blankWhen a window is opened, the url is loaded into a new, unnamed window.
_parentWhen a new window is opened, the url is loaded into the current frame's parent. If the frame has no parent, this value acts as the value _self.
_searchDisabled in Windows Internet Explorer 7, see Security and Compatibility in Internet Explorer 7 for details. Otherwise, when a window is opened, the url is opened in the browser's search pane in Microsoft Internet Explorer 5 or later.
_selfWhen a window id opened, the current document is replaced with the specified url.
_topurl replaces any framesets that are loaded. If there are no framesets defined, this value acts as the _self value.
_mediaThe url is loaded in the Media Bar in Internet Explorer 6. Windows XP Service Pack 2 (SP2) and later. This feature is no longer supported. By default the url is loaded into a new browser window or tab.
 
features:DOMString — Optional. A list of comma-separated items. Each item consists of an option and a value, separated by an equals sign (=), for example, "fullscreen=yes, toolbar=yes". The following features are supported.
ValueDescription
channelmode = { yes | no | 1 | 0 }Specifies whether to display the window in theater mode. The default is no. Internet Explorer 7. channelmode = { yes | 1 } overrides the height value, the width value, the top value, and the left value. When active, the Navigation Bar is hidden, and the Title Bar is visible. The Channel Band is no longer supported in Internet Explorer 7. Prior to Internet Explorer 7 channelmode = { yes | 1 } displays the Channel Band in theatre mode.
directories = { yes | no | 1 | 0 }Specifies whether to add directory buttons. The default is yes. Internet Explorer 7. This feature is no longer supported.
fullscreen = { yes | no | 1 | 0 }Specifies whether to display the browser in full-screen mode. The default is no. Use full-screen mode carefully. Because this mode hides the browser's title bar and menus, you should always provide a button or other visual clue to help the user close the window. ALT+F4 closes the new window. Internet Explorer 7. A window in full-screen mode does not have to be in theatre mode. Prior to Internet Explorer 7, a window in full-screen mode must in theater mode (channelmode).
height = numberInternet Explorer 7. Sets the height of the window in pixels. The minimum value is 150, and specifies the minimum height of the browser content area. Prior to Internet Explorer 7, the minimum height value is 100.
left = numberSpecifies the left position, in pixels. This value is relative to the upper-left corner of the screen. The value must be greater than or equal to zero.
location = { yes | no | 1 | 0 }Internet Explorer 7. Specifies whether to display the navigation bar. The default is yes. Prior to Internet Explorer 7, this feature specifies whether to display the address bar. The Back command, the Forward command, and the Stop command are now located in the Navigation bar. Prior to Internet Explorer 7, navigation commands were located in the toolbar.
menubar = { yes | no | 1 | 0 }Specifies whether to display the menu bar. The default is yes. Internet Explorer 7. By default the menu bar is hidden, unless it is revealed by the ALT key. menubar = { no | 0 } prohibits the menubar from appearing even when the ALT key is pressed. The combination of menubar = { no | 0 } and toolbar = { no | 0 } hides the toolbar and disables any additional third-party user interfaces.
resizable = { yes | no | 1 | 0 }Specifies whether to display resize handles at the corners of the window. The default is yes. Internet Explorer 7. resizable = { no | 0 } disables tabs in a new window.
scrollbars = { yes | no | 1 | 0 }Specifies whether to display horizontal and vertical scroll bars. The default is yes.
status = { yes | no | 1 | 0 }Specifies whether to add a Status Bar at the bottom of the window. The default is yes.
titlebar = { yes | no | 1 | 0 }Specifies whether to display a Title Bar for the window. The default is yes. Internet Explorer 5.5 and later. This feature is no longer supported. The Title Bar remains visible unless the fullscreen sFeature is active. This parameter is ignored prior to Internet Explorer 5.5. It applies only if the calling application is an HTML Application or a trusted dialog box.
toolbar = { yes | no | 1 | 0 }Internet Explorer 7. Specifies whether to display the browser command bar, making buttons such as Favorites Center, Add to Favorites, and Tools available. The default is yes. The combination of menubar = { no | 0 } and toolbar = { no | 0 } turns off the Toolbar and any additional third-party user interfaces. Prior to Internet Explorer 7, the toolbar sFeature specifies whether to display the browser toolbar, making buttons such as Back, Forward, and Stop available.
top = numberSpecifies the top position, in pixels. This value is relative to the upper-left corner of the screen. The value must be greater than or equal to zero.
width = numberInternet Explorer 7. Sets the width of the window in pixels. The minimum value is 250, and specifies the minimum width of the browser content area. Prior to Internet Explorer 7, the minimum height value is 100.
 
replace:Boolean — Optional. When the url is loaded into the same window, this Boolean parameter specifies whether the url creates a new entry or replaces the current entry in the window's history list.

Returns
* — Returns a reference to the new document object or the window object. Use this reference to access properties and methods of the new document or window.

See also


Example
W3C / Mozilla Example
         // In this example, the document contents are 
         // overwritten as the document 
         // is reinitialized on open(). 
         document.write("<html><p>remove me</p></html>"); 
         document.open(); 
         // document is empty.

IE Style

The following example shows how to use the open method to replace the current document with a new document and display the HTML markup contained in the variable sMarkup.

         <html>
         <head>
         <title>First Document</title>
         <script>
         function replace(){
             var oNewDoc = document.open("text/html", "replace");
             var sMarkup = "<html><head><title>New Document</title></head><body>Hello, world</body></html>";
             oNewDoc.write(sMarkup);
             oNewDoc.close();
         }
         
         </script>
         </head>
         <body>
         <h1>I just want to say</h1><br>
         <!--Button will call the replace function and replace the current page with a new one-->
         <input type ="button" value = "Finish Sentence" onclick="replace();">
         </body>
         
         </html>
queryCommandEnabled()method 
public function queryCommandEnabled(cmdId:DOMString):Boolean

Non-standard (Microsoft/Mozilla)

Determines whether the given command can be executed on the document in its current state.

Note (IE): Using queryCommandEnabled ("delete") on a TextRange object returns true, while queryCommandEnabled ("delete") on a document object returns false. However, execCommand ("delete") can still be used to delete the selected text.

Parameters

cmdId:DOMString — Specifies a command identifier.

Returns
Boolean — True if successful, or an error value otherwise.

See also

queryCommandIndeterm()method 
public function queryCommandIndeterm(cmdId:DOMString):Boolean

Non-standard (Microsoft/Mozilla)

Determines whether the current selection is in an indetermined state.

Parameters

cmdId:DOMString — Specifies a command identifier.

Returns
Boolean — True if successful, or an error value otherwise.

See also

queryCommandState()method 
public function queryCommandState(cmdId:DOMString):Boolean

Non-standard (Microsoft/Mozilla)

Determines whether the given command has been executed on the current selection.

Parameters

cmdId:DOMString — Specifies a command identifier.

Returns
Boolean — True if the command has been completed; false if the command has not completed; null if the state cannot be accurately determined.

See also

queryCommandSupported()method 
public function queryCommandSupported(cmdId:DOMString):Boolean

Non-standard (Microsoft/Mozilla)

Returns a Boolean value that indicates whether the current command is supported on the current range.

Parameters

cmdId:DOMString — Specifies a command identifier.

Returns
Boolean — True if successful, or an error value otherwise.

See also

queryCommandText()method 
public function queryCommandText(cmdId:DOMString):DOMString

Non-standard (Microsoft/Mozilla)

Retrieves the string associated with a command.

Parameters

cmdId:DOMString — Specifies a command identifier.

Returns
DOMString — The text associated with the command will be stored.

See also

queryCommandValue()method 
public function queryCommandValue(cmdId:DOMString):*

Non-standard (Microsoft/Mozilla)

Determines the current value of the document, range, or current selection for the given command.

Parameters

cmdId:DOMString — Specifies a command identifier.

Returns
* — True if successful, or an error value otherwise.

See also

recalc()method 
public function recalc(forceAll:Boolean):void

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0 Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0b

Non-standard (Microsoft)

Recalculates all dynamic properties in the current document.

Note: Implicit dependencies, internal property changes, and related properties can cause some expressions not to recalculate, even though the referenced properties might have changed. For example, resizing the main window changes the clientWidth property. Expressions that reference clientWidth might not be recalculated, because the change might not be recognized.

Note: Implicit dependencies refer to properties that can be modified by changes in other properties. For example, the height property of a div object implicitly depends on the innerHTML property of the div object. However, if an expression references the height property, a change in the innerHTML property, which might modify the height, does not cause a recalculation of the expression on a subsequent call to recalc.

Note: Related properties can access or manipulate data or behaviors through one or more other properties. For example, pixelLeft and posLeft can set or get the left position of the element. However, if an expression that references pixelLeft and posLeft is modified, the expression might not be recalculated on subsequent calls to recalc.

Note: Related properties that can cause this behavior include the following: clientHeight, clientLeft, clientTop, clientWidth, height, left, offsetHeight, offsetLeft, offsetTop, offsetWidth, pixelHeight, pixelLeft, pixelTop, pixelWidth, posHeight, posLeft, posTop, posWidth, and top.

Note: To force the recalculation of all expressions, refer to the same property name or manually call recalc(true).

Parameters

forceAll:Boolean — Optional. A Boolean that specifies one of the following values.

See also


Example
The following example uses the recalc method in HTML and script to help create a timer. If the calls to recalc are commented out, the timer does not work correctly.
         <HTML>
         <HEAD> 
         <TITLE>Recalc Example</TITLE>
         <STYLE>
         BUTTON {font-size:14;width:150}
         </STYLE>
         <SCRIPT>
         
         
         var timerID = null;
         var seconds = 0;
         
         //
         // This function is called when the page loads. 
         // It sets up a couple of expressions.
         //
         function init() {
             A.style.setExpression("width","seconds0");
             B.setExpression("innerText","seconds.toString()");
         }
         
         //
         // This function gets calls once a second and updates the seconds
         // variable. Notice that without recalc, the expressions aren't
         // updated until the mouse is moved.
         //
         function timer() {
             seconds++;
             document.recalc();
         }
         
         //
         // starts the timer
         //
         function starttimer() {
             if (timerID == null) {
                 timerID = setInterval("timer()", 1000);
                 startButton.disabled = true;
                 stopButton.disabled = false;
             }
         }
         
         //
         // stops the timer
         //
         function stoptimer() {
             if (timerID != null) {
                 clearInterval(timerID);
                 timerID = null;
                 startButton.disabled = false;
                 stopButton.disabled = true;
             }
         }
         
         //
         //  resets the timer
         //
         function resettimer() {
             seconds = 0;
         }
         
         </SCRIPT>
         </HEAD>
         <BODY onload="init()">
         
         <DIV id=A style="background-color:lightblue" ></DIV>
         <DIV id=B style="color:hotpink;font-weight:bold"></DIV>
         
         <BR>
         
         <BUTTON id="startButton" onclick="starttimer()">Start the Timer</BUTTON></BR>
         <BUTTON id="stopButton" DISABLED="true" onclick="stoptimer()">Stop the Timer</BUTTON><BR>
         <BUTTON id="resetButton" onclick="resettimer()">Reset the Timer</BUTTON><BR>
         
         <P style="width:320;color:peru;background-color:wheat">
         
         This example illustrates the use of document.recalc().  If the calls
         to recalc are omitted in this example, expressions will not be updated 
         until the mouse is moved.
         </P>
         
         </BODY>
         </HTML>
releaseCapture()method 
public function releaseCapture():void

Product Versions : Internet Explorer 5.5 Internet Explorer 6.0 Internet Explorer 7.0 Internet Explorer 8.0 as IE7 Internet Explorer 8.0 as IE8 Firefox 2.0 Firefox 3.0 Firefox 3.5 Safari 3.0 Safari 3.1 Safari 4.0 Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0b

Non-standard (Microsoft)

Removes mouse capture from the object in the current document.

For releaseCapture to have an effect, you must set mouse capture through the setCapture method.

You can invoke the releaseCapture method on the document object. The releaseCapture method makes it unnecessary to determine which element has capture to programmatically release it. Other actions that release document capture include displaying a modal dialog box and switching focus to another application or browser window.

See also


Example
         <BODY onload="oOwnCapture.setCapture();" onclick="document.releaseCapture();">
         <DIV ID=oOwnCapture onmousemove="oWriteLocation.value = event.clientX + event.clientY"; onlosecapture="alert(event.srcElement.id + ' has lost mouse capture.')">
         <TEXTAREA ID=oWriteLocation COLS=2></TEXTAREA>
         </DIV>
         <HR>
         <DIV ID=oNoCapture>
         <P>Click the document to invoke the releaseCapture method.</P>
         </DIV>
         </BODY>
Non-Standard Obsolete releaseEvents()method 
public function releaseEvents(eventTypeList:DOMString):void

Non-standard (Mozilla)

Obsolete

The opposite of document.captureEvents( ), this method turns off event capture at the document level for one or more specific events named in the parameter list.

Parameters

eventTypeList:DOMString — A comma-separated list of case-sensitive event types as derived from the available Event object constants, such as Event.CLICK or Event.MOUSEMOVE.

See also

removeNode()method 
public function removeNode(removeChildren:Boolean = false):Node

Non-standard (Microsoft)

Removes the object from the document hierarchy.

This property is accessible at run time. If elements are removed at run time, before the closing tag is parsed, areas of the document might not render.

Parameters

removeChildren:Boolean (default = false) — If the childNodes collection of the object is removed

Returns
Node — Returns a reference to the object that is removed.

See also

replaceNode()method 
public function replaceNode(newNode:Node):Node

Non-standard (Microsoft)

Replaces the object with another element.

When a node is replaced, all values that are associated with the replaced object are removed. For example, if a b object is replaced with an i object, any attributes and text between the opening and closing tags are also replaced. To preserve these values, copy them to the new element before the original object is replaced.

This method is accessible at run time. If elements are removed at run time before the closing tag is parsed, areas of the document might not render.

Parameters

newNode:Node — Specifies the new element to replace the object.

Returns
Node — Returns a reference to the object that is replaced.

See also


Example
         <SCRIPT>
         function fnReplace() {
         var sPreserve = oList.innerHTML;
         var oNewNode = document.createElement("OL");
         oList.replaceNode(oNewNode);
         oNewNode.innerHTML = sPreserve;
         }
         </SCRIPT>
         
         <UL ID = oList>
         <LI>List Item 1
         <LI>List Item 2
         <LI>List Item 3
         <LI>List Item 4
         </UL>
         <INPUT TYPE = button VALUE = "Replace List" onclick = "fnReplace()">
Non-Standard Obsolete routeEvent()method 
public function routeEvent(event:Event):void

Non-standard (Mozilla)

Obsolete

Used inside an event handler function, this method lets the event pass to its intended target object.

Parameters

event:Event

See also

swapNode()method 
public function swapNode(node:Node):Node

Non-standard (Microsoft)

Exchanges the location of two objects in the document hierarchy.

This method is accessible at run time. If elements are removed at run time, before the closing tag is parsed, areas of the document might not render.

Parameters

node:Node — Specifies the existing element.

Returns
Node — Returns a reference to the object that invoked the method.

See also


Example
         <script>
                 function fnSwap() {
                     oList.children(0).swapNode(oList.children(1));
                 }
         </script>
         
         <ul ID = oList>
                 <li>List Item 1</li>
                 <li>List Item 2</li>
                 <li>List Item 3</li>
                 <li>List Item 4</li>
         </ul>
         <input type=button value="Swap List" onclick="fnSwap()">
DOM 1 HTML write()method 
public function write(text:DOMString):void

Introduced in: DOM 1 HTML 

Write a string of text to a document stream opened by open(). Note that the function will produce a document which is not necessarily driven by a DTD and therefore might be produce an invalid result in the context of the document.

Note (Mozilla): Writing to a document that has already loaded without calling document.open() will automatically perform a document.open call. Once you have finished writing, it is recommended to call document.close(), to tell the browser to finish loading the page. The text you write is parsed into the document's structure model. In the example above, the h1 element becomes a node in the document.

Note (Mozilla): If the document.write() call is embedded directly in the HTML code, then it will not call document.open(). For example:

         <div> 
             <script type="text/javascript"> 
                 document.write("<h1>Main title</h1>") 
             </script> 
         </div>

Parameters

text:DOMString — The string to be parsed into some structure in the document structure model.

See also


Example
         <html>
         
         <head>
         <title>write example</title>
         
         <script type="text/javascript">
         
         function newContent() {
             alert("load new content");
             document.open();
             document.write("<h1>Out with the old - in with the new!</h1>");
             document.close();
         }
         
         
         </script>
         </head>
         
         <body onload="newContent();">
             <p>Some original document content.</p>
         </body>
         </html>
DOM 1 HTML writeln()method 
public function writeln(text:DOMString):void

Introduced in: DOM 1 HTML 

Write a string of text followed by a newline character to a document stream opened by open(). Note that the function will produce a document which is not necessarily driven by a DTD and therefore might be produce an invalid result in the context of the document.

Note: document.writeln is the same as document.write but adds a newline.

Parameters

text:DOMString — The string to be parsed into some structure in the document structure model.

See also


Example
document.writeln("<p>enter password:</p>");