Packagedom.core
Classpublic class Element
InheritanceElement Inheritance Node Inheritance Object
Implements ElementView, ElementTraversal, NodeSelector
Subclasses HTMLElement

The Element interface represents an element in an HTML or XML document.

Elements may have attributes associated with them; since the Element interface inherits from Node, the generic Node interface attribute attributes may be used to retrieve the set of all attributes for an element. There are methods on the Element interface to retrieve either an Attr object by name or an attribute value by name. In XML, where an attribute value may contain entity references, an Attr object should be retrieved to examine the possibly fairly complex sub-tree representing the attribute value. On the other hand, in HTML, where all attributes have simple string values, methods to directly access an attribute value can safely be used as a convenience.

Note: In DOM Level 2, the method normalize is inherited from the Node interface where it was moved.

Includes the ElementTraversal Specification



Public Properties
 PropertyDefined By
 InheritedDOM 1 Core attributes : NamedNodeMap
[read-only] Returns an unordered collection of Attr nodes.
Node
 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
   baseURIObject : nsIURI
[read-only] Non-Standard | FireFox 3+ Returns the nsIURI object representing the element's URI.
Element
  Element Traversal childElementCount : Number
[read-only] Returns the current number of element nodes that are children of this element.
Element
 InheritedDOM 1 Core childNodes : NodeList
[read-only] Returns an ordered collection of node objects that are children of the current element.
Node
   children : NodeList
[read-only] ? | FireFox 3.5+ Returns a collection of child elements of the given element.
Element
  DOM 3 Core clientHeight : Number
[read-only] Returns the inner height of an element in pixels, including padding but not the horizontal scrollbar height, border, or margin.
Element
  DOM 3 Core clientLeft : Number
[read-only] The width of the left border of an element in pixels.
Element
  DOM 3 Core clientTop : Number
[read-only] The width of the top border of an element in pixels.
Element
  DOM 3 Core clientWidth : Number
[read-only] Returns the inner width of an element in pixels.
Element
 InheritedNon-Standard dataType : *
Specifies the data type for this node.
Node
 InheritedNon-Standard definition : Node
[read-only] Returns the definition of the node in the document type definition (DTD) or schema.
Node
 InheritedDOM 1 Core firstChild : Node
[read-only] Returns the node's first child in the tree, or null if the node is childless.
Node
  Element Traversal firstElementChild : Element
[read-only] Returns the first child element node of this element.
Element
   innerHTML : DOMString
DOM Level 0 | NS\FireFox\IE4+ Sets or gets all of the markup and content within a given element.
Element
 InheritedDOM 1 Core lastChild : Node
[read-only] Returns the last child of a node.
Node
  Element Traversal lastElementChild : Element
[read-only] Returns the last child element node of this element.
Element
 InheritedDOM 2 Core localName : DOMString
[read-only] Returns the local part of the qualified name of this node.
Node
 InheritedDOM 2 Core namespaceURI : DOMString
[read-only] The namespace URI of the node, or null if it is unspecified (read-only).
Node
  Element Traversal nextElementSibling : Element
[read-only] Returns the next sibling element node of this element.
Element
 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
  DOM 3 Core offsetHeight : Number
[read-only] Height of an element relative to the element's offsetParent.
Element
  DOM 3 Core offsetLeft : Number
[read-only] Returns the number of pixels that the upper left corner of the current element is offset to the left within the offsetParent node.
Element
  DOM 3 Core offsetParent : Element
[read-only] The element from which all offset calculations are currently computed.
Element
  DOM 3 Core offsetTop : Number
[read-only] Returns the distance of the current element relative to the top of the offsetParent node.
Element
  DOM 3 Core offsetWidth : Number
[read-only] The width of an element, relative to the layout.
Element
 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
 InheritedNon-Standard parsed : Boolean
[read-only] Indicates the parsed status of the node and child nodes.
Node
 InheritedDOM 2 Core prefix : DOMString
Returns the namespace prefix of the specified node, or null if no prefix is specified.
Node
  Element Traversal previousElementSibling : Element
[read-only] Returns the previous sibling element node of this element.
Element
 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
   schemeTypeInfo : TypeInfo
[read-only] DOM Level 3 | None The type information associated with this element.
Element
  DOM 3 Core scrollHeight : Number
[read-only] Height of the scroll view of an element; it includes the element padding but not its margin.
Element
  DOM 3 Core scrollLeft : Number
Gets or sets the number of pixels that an element's content is scrolled to the left.
Element
  DOM 3 Core scrollTop : Number
Gets or sets the number of pixels that the content of an element is scrolled upward.
Element
  DOM 3 Core scrollWidth : Number
[read-only] Returns either the width in pixels of the content of an element or the width of the element itself, whichever is greater.
Element
 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
  DOM 2 Core tagName : DOMString
[read-only] The name of the element.
Element
 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
 InheritedNon-Standard xml : DOMString
[read-only] Contains the XML representation of the node and all its descendants.
Node
Public Methods
 MethodDefined By
  
Non-Standard addBehavior(url:DOMString):Number
Attaches a behavior to the element.
Element
 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 1 Core appendChild(element:Node):Node
Adds a node to the end of the list of children of a specified parent node.
Node
  
Non-Standard applyElement(element:Object, where:DOMString = outside):Object
Makes the element either a child or parent of another element.
Element
  
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.
Element
  
Non-Standard clearAttributes():void
Removes all attributes and values from the object.
Element
 Inherited
DOM 1 Core cloneNode(cloneChildren:Boolean):Node
Returns a duplicate of the current node.
Node
 Inherited
DOM 3 Core compareDocumentPosition(other:Node):Number
Compares the position of the current node against another node in any other document.
Node
  
Non-Standard componentFromPoint(x:Number, y:Number):DOMString
Returns the component located at the specified coordinates via certain events.
Element
  
Non-Standard contains(element:Object):Boolean
Checks whether the given element is contained within the object.
Element
  
Creates a controlRange collection of nontext elements.
Element
  
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.
Element
 Inherited
DOM 2 Events dispatchEvent(evt:Event):Boolean
Dispatches an event to fire on a node artificially.
Node
  
Non-Standard doScroll(scrollAction:DOMString = scrollbarDown):void
Simulates a click on a scroll-bar component.
Element
  
Non-Standard dragDrop():Boolean
Initiates a drag event.
Element
  
Non-Standard fireEvent(type:DOMString, event:Object = null):Boolean
Fires a specified event on the object.
Element
  
Non-Standard getAdjacentText(where:DOMString):DOMString
Returns the adjacent text string.
Element
  
DOM 1 Core getAttribute(name:DOMString):Object
Returns the value of the named attribute on the specified element.
Element
  
DOM 2 Core getAttributeNode(name:DOMString):Attr
Returns the Attr node for the attribute with the given name.
Element
  
DOM 2 Core getAttributeNodeNS(nameSpace:DOMString, name:DOMString):Attr
Returns the Attr node for the attribute with the given namespace and name.
Element
  
DOM 2 Core getAttributeNS(nameSpace:DOMString, name:DOMString):DOMString
Returns the string value of the attribute with the specified namespace and name.
Element
  
Retrieves an object that specifies the bounds of a collection of TextRectangle objects.
Element
  
Retrieves a collection of rectangles that describes the layout of the contents of an object or range within the client.
Element
  
Returns a set of elements with the given class name.
Element
  
Retrieves a collection of objects based on the specified element name.
Element
  
DOM 2 Core getElementsByTagNameNS(nameSpace:DOMString, localName:DOMString):NodeList
Returns a list of elements with the given tag name belonging to the given namespace.
Element
  
Non-Standard getExpression(propertyName:DOMString):*
Retrieves the expression for the given property.
Element
 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
Retrieves the object associated to a key on a this node.
Node
  
DOM 2 Core hasAttribute(name:DOMString):Boolean
DOM Level 2 | NS\FireFox Determines whether an attribute with the specified name exists.
Element
  
DOM 2 Core hasAttributeNS(nameSpace:DOMString, name:DOMString):Boolean
Returns a boolean value indicating whether the current element has the specified attribute.
Element
 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
  
Non-Standard insertAdjacentElement(where:DOMString, element:Element):Element
Inserts an element at the specified location.
Element
  
Non-Standard insertAdjacentHTML(where:DOMString, text:DOMString):void
Inserts the given HTML text into the element at the location.
Element
  
Non-Standard insertAdjacentText(where:DOMString, text:DOMString):void
Inserts the given text into the element at the specified location.
Element
 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
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
  
Non-Standard mergeAttributes(source:Element, preserve:Boolean = true):void
Copies all read/write attributes to the specified element.
Element
 Inherited
DOM 1 Core normalize():void
Puts the specified node and all of its subtree into a "normalized" form.
Node
  
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.
Element
  
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.
Element
  
Non-Standard releaseCapture():void
Removes mouse capture from the object in the current document.
Element
  
DOM 1 Core removeAttribute(name:DOMString):void
Removes an attribute from the specified element.
Element
  
DOM 1 Core removeAttributeNode(name:Attr):Attr
Removes an attribute object from the object.
Element
  
DOM 2 Core removeAttributeNS(nameSpace:DOMString, name:DOMString):void
Removes the specified attribute from an element.
Element
  
Non-Standard removeBehavior(id:Number):Boolean
Detaches a behavior from the element.
Element
 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 removeExpression(propertyName:DOMString):Boolean
Removes the expression from the specified property.
Element
  
Non-Standard removeNode(removeChildren:Boolean = false):Node
Removes the object from the document hierarchy.
Element
  
Non-Standard replaceAdjacentText(where:DOMString, replaceText:DOMString):DOMString
Replaces the text adjacent to the element.
Element
 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.
Element
  
DOM 0 scrollIntoView(alignToTop:Boolean = true):void
Causes the object to scroll into view, aligning it either at the top or bottom of the window.
Element
 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
  
Non-Standard setActive():void
Sets the object as active without setting focus to the object.
Element
  
DOM 1 Core setAttribute(name:DOMString, value:Number, caseSensitive:*):void
Sets the value of the specified attribute.
Element
  
DOM 1 Core setAttributeNode(attrNode:Attr):Attr
Sets an attribute object node as part of the object.
Element
  
DOM 2 Core setAttributeNodeNS(attrNode:Attr):void
Adds a new attribute node with the specified namespace and name.
Element
  
DOM 2 Core setAttributeNS(nameSpace:DOMString, name:DOMString, value:*):void
Adds a new attribute or changes the value of an attribute with the given namespace and name.
Element
  
Non-Standard setCapture(containerCapture:Boolean = true):void
Sets the mouse capture to the object that belongs to the current document.
Element
  
Non-Standard setExpression(propertyName:DOMString, expression:DOMString, language:DOMString):void
Sets an expression for the specified object.
Element
  
DOM 3 Core setIdAttribute(name:DOMString, isId:Boolean):void
If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute.
Element
  
DOM 3 Core setIdAttributeNode(idAttr:Attr, isId:Boolean):void
If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute.
Element
  
DOM 3 Core setIdAttributeNS(nameSpaceURI:DOMString, name:DOMString, isId:Boolean):void
If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute.
Element
 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.
Element
 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
Events
 Event Summary Defined By
  Loading of a resource has been aborted.Element
  An event target loses focus.Element
  A control loses the input focus and its value has been modified since gaining focus.Element
  A pointing device button is clicked over an element.Element
  A pointing device button is clicked twice over an element.Element
  Refer to Activation requests and behavior.Element
  Occurs after the namespaceURI and/or the nodeName of a Attr node have been modified (e.g., the attribute was renamed using Document.renameNode()).Element
  Occurs after Attr.value has been modified and after an Attr node has been added to or removed from an Element.Element
  Gecko-Specific Fired on a Window object when a document's DOM content is finished loading, but unlike "load", does not wait until all images are loaded.Element
  Occurs after the namespaceURI and/or the nodeName of an Element node have been modified (e.g., the element was renamed using Document.renameNode()).Element
  An event target receives focus.Element
  An event target loses focus.Element
  Gecko-Specific Same as DOMContentLoaded, but also fired for enclosed frames.Element
  Gecko-Specific UndocumentedElement
  Gecko-Specific UndocumentedElement
  Gecko-Specific UndocumentedElement
  Gecko-Specific UndocumentedElement
  Gecko-Specific The DOMMouseScroll event is sent when the mouse wheel is moved.Element
  A node has been added as a child of another node or, in case of Attr nodes, has been added to an Element.Element
  A node has been inserted into a document, either through direct insertion of the node or insertion of a subtree in which it is contained; Attr nodes are considered part of an Element's subtree.Element
  A node is being removed from its parent node or, in case of Attr nodes, removed from its ownerElement.Element
  A node is being removed from a document, either through direct removal of the node or removal of a subtree in which it is contained; Attr nodes are considered part of an Element's subtree.Element
  This is a general event for notification of all changes to the document.Element
  Gecko-Specific UndocumentedElement
  Gecko-Specific UndocumentedElement
  Gecko-Specific Fired when the window is about to be closed by window.close().Element
  A resource failed to load, or has been loaded but cannot be interpreted according to its semantics such as an invalid image, a script execution error, or non-well-formed XML.Element
  An event target receives focus.Element
  Gecko-Specific UndocumentedElement
  A key is pressed down.Element
  A key is released.Element
  The DOM Implementation finishes loading the resource (such as the document) and any dependent resources (such as images, style sheets, or scripts).Element
  A pointing device button is pressed over an element.Element
  A pointing device is moved while it is over an element.Element
  A mouse wheel has been rotated.Element
  A pointing device is moved away from an element.Element
  A pointing device is moved onto an element.Element
  A pointing device button is released over an element.Element
  A mouse wheel has been rotated around the y-axis.Element
  Gecko-Specific | Firefox 3.5+ The MozAfterPaint event is fired whenever content is repainted.Element
  Gecko-Specific | Firefox 3.5+ Regular mouse wheels can only scroll with a per-line resolution.Element
  Gecko-Specific UndocumentedElement
  Gecko-Specific UndocumentedElement
  A form, such as a [HTML 4.01] or [XHTML 1.0] form, is reset.Element
  A document view or an element has been resized.Element
  A document view or an element has been scrolled.Element
  A user selects some text.Element
  A form, such as a [HTML 4.01] or [XHTML 1.0] form, is submitted.Element
  One or more characters have been entered.Element
  The DOM implementation removes from the environment the resource (such as the document) or any dependent resources (such as images, style sheets, scripts).Element
  Gecko-Specific UndocumentedElement
  Gecko-Specific UndocumentedElement
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
baseURIObjectproperty
baseURIObject:nsIURI  [read-only]

Non-Standard | FireFox 3+ Returns the nsIURI object representing the element's URI.

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


Implementation
    public function get baseURIObject():nsIURI
Element Traversal childElementCountproperty 
childElementCount: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.0 Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0b

Returns the current number of element nodes that are children of this element. 0 if this element has no child nodes that are of nodeType 1.


Implementation
    public function get childElementCount():Number

See also

childrenproperty 
children:NodeList  [read-only]

? | FireFox 3.5+ Returns a collection of child elements of the given element.

The list returned is an ordered collection of element objects that are children of the current element. If the element has no children, then list returned contains no elements.

Note: The items in the collection of elements are objects and not strings. To get data from those node objects, you must use their properties (e.g. elementNodeReference.children[1].nodeName to get the name, etc.).


Implementation
    public function get children():NodeList

Example
         // parg is an object reference to a <p> element
         if (parg.childElementCount()) {
             // So, first we check if the object is not empty, if the object has child nodes
             var children = parg.children;
             for (var i = 0; i < children.length; i++) {
             // do something with each child element as children[i]
             // NOTE: List is live, Adding or removing children will change the list
             };
         };
         
DOM 3 Core clientHeightproperty 
clientHeight: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.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in:  

Returns the inner height of an element in pixels, including padding but not the horizontal scrollbar height, border, or margin.

clientHeight can be calculated as CSS height + CSS padding - height of horizontal scrollbar (if present).

Note: offsetLeft returns the position the upper left edge of the element; not necessarily the 'real' left edge of the element. This is important for span elements in flowed text that wraps from one line to the next. The span may start in the middle of the page and wrap around to the beginning of the next line. The offsetLeft will refer to the left edge of the start of the span, not the left edge of text at the start of the second line. Therefore, a box with the left, top, width and height of offsetLeft, offsetTop, offsetWidth and offsetHeight will not be a bounding box for a span with wrapped text.


Implementation
    public function get clientHeight():Number

See also


Example
This example shows how the clientHeight property and the offsetHeight property measure document height differently. The height of the div is set to 100, and this is the value retrieved by the offsetHeight property, not the clientHeight property.
         <div id=oDiv style="overflow:scroll; width:200; height:100"> . . . </div>
         <button onclick="alert(oDiv.clientHeight)">client height</button>
         <button onclick="alert(oDiv.offsetHeight)">offset heightY</button>
DOM 3 Core clientLeftproperty 
clientLeft: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.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in:  

The width of the left border of an element in pixels.

It includes the width of the vertical scrollbar if the text direction of the element is right–to–left and if there is an overflow causing a left vertical scrollbar to be rendered. clientLeft does not include the left margin or the left padding.

Note: The difference between the offsetLeft and clientLeft properties is the border of the object.

Note: When layout.scrollbar.side property is set to 1 or to 3 and when the text-direction is set to RTL, then the vertical scrollbar is positioned on the left and this impacts the way clientLeft is computed.


Implementation
    public function get clientLeft():Number

See also

DOM 3 Core clientTopproperty 
clientTop: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.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in:  

The width of the top border of an element in pixels. It does not include the top margin or padding.

Note: The difference between the offsetTop and the clientTop properties is the border area of the object.


Implementation
    public function get clientTop():Number

See also

DOM 3 Core clientWidthproperty 
clientWidth: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.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in:  

Returns the inner width of an element in pixels. It includes padding but not the vertical scrollbar (if present, if rendered), border or margin.


Implementation
    public function get clientWidth():Number

See also


Example
This example shows how the clientWidth property and the offsetWidth property measure document width differently. The width of the div is set to 200, and this is the value retrieved by the offsetWidth property, not the clientWidth property.
         <div id=oDiv style="overflow:scroll; width:200; height:100"> . . . </div>
         <button onclick="alert(oDiv.clientWidth)">client width</button>
         <button onclick="alert(oDiv.offsetWidth)">offset widthY</button>
Element Traversal firstElementChildproperty 
firstElementChild:Element  [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.0 Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0b

Returns the first child element node of this element. null if this element has no child elements.


Implementation
    public function get firstElementChild():Element

See also


Example
In this example, the alert shows "SPAN", which is the name of the first child node of the paragraph element.
         <p id="para-01">
             <span>First span</span>
         </p>
         
         <script type="text/javascript">
             var p01 = document.getElementById('para-01');
             alert(p01.firstElementChild.nodeName);
         </script>
innerHTMLproperty 
innerHTML:DOMString

DOM Level 0 | NS\FireFox\IE4+ Sets or gets all of the markup and content within a given element.

Note: As there is no public specification for this property, implementations differ widely. For example, when text is entered into a text input, IE will change the value attribute of the input's innerHTML property but Gecko browsers do not.

Note: It should never be used to write parts of a table—W3C DOM methods should be used for that—though it can be used to write an entire table or the contents of a cell.


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

Example
         // HTML:
         // <div id="d"><p>Content</p>
         // <p>Further Elaborated</p>
         // </div>
         
         d = document.getElementById("d");
         dump(d.innerHTML);
         
         // the string "<p>Content</p><p>Further Elaborated</p>"
         // is dumped to the console window
         
Element Traversal lastElementChildproperty 
lastElementChild:Element  [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.0 Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0b

Returns the last child element node of this element. null if this element has no child elements.


Implementation
    public function get lastElementChild():Element

See also


Example
In this example, the alert shows "B", which is the name of the last child node of the paragraph element.
         <p id="para-01">
             <span>First span</span>
             <b>bold</b>
         </p>
         
         <script type="text/javascript">
             var p01 = document.getElementById('para-01');
             alert(p01.lastElementChild.nodeName);
         </script>
Element Traversal nextElementSiblingproperty 
nextElementSibling:Element  [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.0 Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0b

Returns the next sibling element node of this element. null if this element has no element sibling nodes that come after this one in the document tree.


Implementation
    public function get nextElementSibling():Element

See also


Example
         <div id="div-01">Here is div-01</div>
         <div id="div-02">Here is div-02</div>
         
         <script type="text/javascript">
             var el = document.getElementById('div-01').nextElementSibling;
             document.write('<p>Siblings of div-01</p><ol>');
             while (el) {
                 document.write('<li>' + el.nodeName + '</li>');
                 el = el.nextElementSibling;
             }
             document.write('</ol>');
         </script>

This example outputs the following into the page when it loads:

Siblings of div-01

  1. DIV
  2. SCRIPT
  3. P
  4. OL
DOM 3 Core offsetHeightproperty 
offsetHeight: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.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in:  

Height of an element relative to the element's offsetParent.

Typically, an element's offsetHeight is a measurement which includes the element borders, the element vertical padding, the element horizontal scrollbar (if present, if rendered) and the element CSS height.

For the document body object, the measurement includes total linear content height instead of the element CSS height. Floated elements extending below other linear content are ignored.

Note (IE6): To comply with the Cascading Style Sheets, Level 1 (CSS1) World Wide Web link box model, Microsoft Internet Explorer 6 and later calculate the height of objects differently when you use the !DOCTYPE declaration in your document to switch on standards-compliant mode. This difference may affect the value of the offsetWidth propety. When standards-compliant mode is switched on, the width property specifies the distance between the left and right edges of the bounding box that surrounds the object's content. When standards-compliant mode is not switched on, and with earlier versions of Windows Internet Explorer, the width property also includes the border and padding belts that surround the object's bounding box.


Implementation
    public function get offsetHeight():Number

See also


Example
This example adjusts the size of a clock's readout to fit the current width and height of the document body.
         <html>
         <head>
         <title>A Simple Clock</title>
         <script type="text/javascript">
             function startClock() {
                 window.setInterval("Clock_Tick()", 1000);
                 Clock_Tick();
             }
         
             var iRatio = 4;
             function Clock_Tick() {
                 var dToday = Date();
                 var sTime = dToday.substring(11,19);
                 var iDocHeight = document.body.offsetHeight;
                 var iDocWidth = document.body.offsetWidth;
         
                 if ((iDocHeightRatio)>iDocWidth)
                 iDocHeight = iDocWidth / iRatio;
                 document.all.MyTime.innerText = sTime;
                 document.all.MyTime.style.fontSize = iDocHeight;
             }
         </script>
         </head>
         <body onload="startClock()">
         <p id="MyTime"> </p>
         </body>
         </html>
DOM 3 Core offsetLeftproperty 
offsetLeft: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.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in:  

Returns the number of pixels that the upper left corner of the current element is offset to the left within the offsetParent node.

Note: offsetLeft returns the position the upper left edge of the element; not necessarily the 'real' left edge of the element. This is important for inline elements (such as span) in flowed text that wraps from one line to the next. The span may start in the middle of the line and wrap around to the beginning of the next line. The offsetLeft will refer to the left edge of the start of the span, not the left edge of text at the start of the second line. Therefore, a box with the left, top, width and height of offsetLeft, offsetTop, offsetWidth and offsetHeight will not be a bounding box for a span with wrapped text.


Implementation
    public function get offsetLeft():Number

See also


Example
         var colorTable = document.getElementById("t1");
         var tOLeft = colorTable.offsetLeft;
         
         if (tOLeft > 5) {
             // large left offset: do something here
         }
DOM 3 Core offsetParentproperty 
offsetParent:Element  [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.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in:  

The element from which all offset calculations are currently computed.

offsetParent returns a reference to the object which is the closest (nearest in the containment hierarchy) positioned containing element. If the element is non-positioned, the root element (html in standards compliant mode; body in quirks rendering mode) is the offsetParent. offsetParent returns null when the element has style.display set to "none".

Note (IE5): In Microsoft Internet Explorer 5, the offsetParent property returns the table object for the td object.

Note (IE4): In Internet Explorer 4.0 it returns the tr object. You can use the parentElement property to retrieve the immediate container of the table cell.


Implementation
    public function get offsetParent():Element

See also


Example
This example shows how to determine the position of a td object. Although the td object appears to the far right in the document, its position is close to the x-axis and y-axis, because its offset parent is a table object rather than the document body. For Internet Explorer 4.0, this same example returns a position of 0,0 because the offset parent is the table row.
         <table border='1' align='right'>
             <tr>
                 <td id='oCell'>This is a small table.</td>
             </tr>
         </table>
         var oElement = document.getElementById("oCell");
         
         alert("The TD element is at (" + oElement.offsetLeft + 
         "," + oElement.offsetTop + ")\n" + "The offset parent is " 
         + oElement.offsetParent.tagName );
DOM 3 Core offsetTopproperty 
offsetTop: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.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in:  

Returns the distance of the current element relative to the top of the offsetParent node.


Implementation
    public function get offsetTop():Number

See also


Example
         d = document.getElementById("div1");
         
         topPos = d.offsetTop;
         
         if (topPos > 10) {
             // object is offset more
             // than 10 pixels from its parent
         }
DOM 3 Core offsetWidthproperty 
offsetWidth: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.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in:  

The width of an element, relative to the layout.

Typically, an element's offsetWidth is a measurement which includes the element borders, the element horizontal padding, the element vertical scrollbar (if present, if rendered) and the element CSS width.

Note (IE6): To comply with the Cascading Style Sheets, Level 1 (CSS1) World Wide Web link box model, Microsoft Internet Explorer 6 and later calculate the height of objects differently when you use the !DOCTYPE declaration in your document to switch on standards-compliant mode. This difference may affect the value of the offsetWidth propety. When standards-compliant mode is switched on, the width property specifies the distance between the left and right edges of the bounding box that surrounds the object's content. When standards-compliant mode is not switched on, and with earlier versions of Windows Internet Explorer, the width property also includes the border and padding belts that surround the object's bounding box.


Implementation
    public function get offsetWidth():Number

See also


Example
This example adjusts the size of a clock's readout to fit the current width and height of the document.
         <div id=oDiv STYLE="overflow:scroll; width:200; height:100"> . . . </div>
         <button onclick="alert(oDiv.clientWidth)">client width</button>
         <button onclick="alert(oDiv.offsetWidth)">offset width</button>
Element Traversal previousElementSiblingproperty 
previousElementSibling:Element  [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.0 Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0b

Returns the previous sibling element node of this element. null if this element has no element sibling nodes that come before this one in the document tree.


Implementation
    public function get previousElementSibling():Element

See also


Example
         <div id="div-01">Here is div-01</div>
         <div id="div-02">Here is div-02</div>
         <li>This is a list item</li>
         <li>This is another list item</li>
         <div id="div-03">Here is div-03</div>
         
         <script type="text/javascript">
             var el = document.getElementById('div-03').previousElementSibling;
             document.write('<p>Siblings of div-03</p><ol>');
             while (el) {
                 document.write('<li>' + el.nodeName + '</li>');
                 el = el.previousElementSibling;
             }
             document.write('</ol>');
         </script>

This example outputs the following into the page when it loads:

Siblings of div-03

  1. LI
  2. LI
  3. DIV
  4. DIV
schemeTypeInfoproperty 
schemeTypeInfo:TypeInfo  [read-only]

DOM Level 3 | None The type information associated with this element.


Implementation
    public function get schemeTypeInfo():TypeInfo
DOM 3 Core scrollHeightproperty 
scrollHeight: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.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in:  

Height of the scroll view of an element; it includes the element padding but not its margin.

An element's scrollHeight is a measurement of the height of an element's content including content not visible on the screen due to overflow.

If the element's content generated a vertical scrollbar, the scrollHeight value is equal to the minimum clientHeight the element would require in order to fit all the content in the viewpoint without using a vertical scrollbar. When an element's content does not generate a vertical scrollbar, then its scrollHeight property is equal to its clientHeight property.


Implementation
    public function get scrollHeight():Number

See also


Example
This example uses the scrollHeight property to retrieve the height of the viewable content.
         <script type="text/javascript">
             function fnCheckScroll(){
                 var iNewHeight = oDiv.scrollHeight;
                 alert("The value of the scrollHeight property is: " 
                 + iNewHeight + "px"); 
             }
         </script>
         ...
         <div id="oDiv" style="overflow: scroll; height= 100px; width= 250px; text-align: left">
             ... 
         </div>
         <button onclick="fnCheckScroll()">Check scrollHeight</button>
DOM 3 Core scrollLeftproperty 
scrollLeft:Number

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.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in:  

Gets or sets the number of pixels that an element's content is scrolled to the left.


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

See also


Example
         // Set the number of pixels scrolled
         element.scrollLeft = 10;
DOM 3 Core scrollTopproperty 
scrollTop:Number

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.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in:  

Gets or sets the number of pixels that the content of an element is scrolled upward.

An element's scrollTop is a measurement of the distance of an element's top to its topmost visible content.

When an element content does not generate a vertical scrollbar, then its scrollTop value defaults to 0.


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

See also


Example
         // Get the number of pixels scrolled
         var  intElemScrollTop = element.scrollTop;
DOM 3 Core scrollWidthproperty 
scrollWidth: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.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in:  

Returns either the width in pixels of the content of an element or the width of the element itself, whichever is greater.

If the element is wider than its content area (for example, if there are scroll bars for scrolling through the content), the scrollWidth is larger than the clientWidth.


Implementation
    public function get scrollWidth():Number

See also


Example
         <div id="aDiv" style="width: 100px; height: 200px; overflow: auto;">
             -FooBar-FooBar-FooBar
         </div>
         <br/>
         <input type="button" value="Show scrollWidth"
         onclick="alert(document.getElementById('aDiv').scrollWidth);">
DOM 2 Core tagNameproperty 
tagName:DOMString  [read-only]

Product Versions : Internet Explorer 5.0 Firefox 1.0 Opera 8.0 Safari 1.3
Introduced in: DOM 2 Core 

The name of the element. If Node.localName is different from null, this attribute is a qualified name.


Implementation
    public function get tagName():DOMString
Method Detail
addBehavior()method
public function addBehavior(url:DOMString):Number

Product Version : Internet Explorer 5.5

Non-standard

Attaches a behavior to the element.

This method, and the following remarks, apply only to attached behaviors, which are the original Dynamic HTML (DHTML) behaviors introduced in Microsoft Internet Explorer 5. Element behaviors are a feature in Internet Explorer 5.5 and cannot be added to or removed from an element.

This method enables you to attach a behavior without using Cascading Style Sheets (CSS).

Unless the specified behavior in the addBehavior call is one of the default behaviors built into Internet Explorer, the addBehavior call causes Internet Explorer to download the behavior asynchronously, before the behavior is attached to the element.

Due to the asynchronous nature of the addBehavior method, its return value cannot be relied on to determine whether the behavior was successfully applied to the element. Waiting for the onreadystatechange event to fire and verifying that the readyState property of the element is set to complete ensure that the behavior is completely attached to the element, and that all the behavior's members are available for scripting. Otherwise, attempting to use any behavior-defined member before the behavior is attached to the element results in a scripting error indicating that the object does not support that particular member.

Note : A behavior attached to an element using the addBehavior method, or by applying the proposed CSS behavior attribute inline, is not automatically detached from the element when the element is removed from the document hierarchy. However, a behavior attached using a style rule defined in the document is detached automatically as the element is removed from the document tree.

Parameters

url:DOMString — Location of the behavior, in URL format.

Returns
Number — Returns an identifier that can be used later to detach the behavior from the element.

Example
         <SCRIPT LANGUAGE="JScript">
         var collBehaviorID = new Array();
         var collLI = new Array ();
         var countLI = 0;
         
         function attachBehavior() {
             collLI = document.all.tags("LI");
             countLI = collLI.length;
             for (i=0; i < countLI; i++) {
                 var iID = collLI[i].addBehavior("hilite.htc");
         
                 if (iID) collBehaviorID[i] = iID;
             }
         }
         </SCRIPT>
         
         //Click <A HREF="javascript:attachBehavior()">here</A>
         //to add a highlighting effect as you hover over each item below.
         
applyElement()method 
public function applyElement(element:Object, where:DOMString = outside):Object

Product Version : Internet Explorer 1.0

Non-standard

Makes the element either a child or parent of another element.

Parameters

element:Object — An object that becomes the child or parent of the current element.
 
where:DOMString (default = outside) — Specifies one of the following values. outside : Specified element becomes a parent of the current element. inside : Specified element becomes a child of the current element, but contains all the child elements of the current element.

Returns
Object — Returns a reference to the applied element.

Example
         <SCRIPT>
         function fnApply() {
             var oNewNode = document.createElement("I");
             oList.applyElement(oNewNode);
         }
         </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="Apply Element" onclick="fnApply()">
         
attachEvent()method 
public function attachEvent(type:DOMString, listener:Function):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)

Binds the specified function to an event, so that the function gets called whenever the event fires on the object.

Parameters

type:DOMString — The event string should include the "on" prefix (ie: "onload", "onclick" etc).
 
listener:Function — The function or method to associate with the event.

Returns
Boolean — true (successful) or false (failed).

See also


Example
if (window.attachEvent) window.attachEvent("onload", statusreport); //invoke function
clearAttributes()method 
public function clearAttributes():void

Product Version : Internet Explorer 5.0

Non-standard

Removes all attributes and values from the object.

The clearAttributes method clears only persistent HTML attributes. The ID attribute, styles, and script-only properties are not affected.

componentFromPoint()method 
public function componentFromPoint(x:Number, y:Number):DOMString

Product Version : Internet Explorer 5.0

Non-standard

Returns the component located at the specified coordinates via certain events.

IE Note: The componentFromPoint method, available as of Microsoft Internet Explorer 5, is applicable to any object that can be given scroll bars through Cascading Style Sheets (CSS).

The componentFromPoint method might not return the same object consistently when it is used with the onmouseover event. Because a user's mouse speed and entry point can vary, different components of an element can fire the onmouseover event. For example, when a user moves the cursor over a textArea object with scroll bars, the event might fire when the mouse enters the component border, the scroll bars, or the client region. After the event fires, the expected element might not be returned, unless the scroll bars were the point of entry for the mouse. In this case, the onmousemove event can be used to provide more consistent results.

For the object's sizing handles to appear, designMode must be On, and the object must be selected.

Parameters

x:Number — The client window coordinate of x
 
y:Number — The client window coordinate of y

Returns
DOMString — Returns one of the following possible values.
  • empty string : Component is inside the client area of the object.
  • outside : Component is outside the bounds of the object.
  • scrollbarDown : Down scroll arrow is at the specified location.
  • scrollbarHThumb : Horizontal scroll thumb or box is at the specified location.
  • scrollbarLeft : Left scroll arrow is at the specified location.
  • scrollbarPageDown : Page-down scroll bar shaft is at the specified location.
  • scrollbarPageLeft : Page-left scroll bar shaft is at the specified location.
  • scrollbarPageRight : Page-right scroll bar shaft is at the specified location.
  • scrollbarPageUp : Page-up scroll bar shaft is at the specified location.
  • scrollbarRight : Right scroll arrow is at the specified location.
  • scrollbarUp : Up scroll arrow is at the specified location.
  • scrollbarVThumb : Vertical scroll thumb or box is at the specified location.
  • handleBottom : Bottom sizing handle is at the specified location.
  • handleBottomLeft : Lower-left sizing handle is at the specified location.
  • handleBottomRight : Lower-right sizing handle is at the specified location.
  • handleLeft : Left sizing handle is at the specified location.
  • handleRight : Right sizing handle is at the specified location.
  • handleTop : Top sizing handle is at the specified location.
  • handleTopLeft : Upper-left sizing handle is at the specified location.
  • handleTopRight : Upper-right sizing handle is at the specified location.
contains()method 
public function contains(element:Object):Boolean

Product Version : Internet Explorer 1.0

Non-standard

Checks whether the given element is contained within the object.

Parameters

element:Object — Element object that specifies the element to check.

Returns
Boolean
createControlRange()method 
public function createControlRange():NodeList

Product Version : Internet Explorer 1.0

Non-standard

Creates a controlRange collection of nontext elements.

IE Note: Creates a selection range object for control-based selection rather than text-based selection.

If a controlRange already exists, createControlRange overwrites the existing element; otherwise, it returns a pointer to the element created.

Returns
NodeList
detachEvent()method 
public function detachEvent(type:DOMString, listener:Function):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

Non-standard (Microsoft)

Unbinds the specified function from the event, so that the function stops receiving notifications when the event fires.

Note (IE): Behaviors that attach to events using the attachEvent method must explicitly call the detachEvent method to stop receiving notifications from the page when the ondetach event fires. Behaviors that attach to events using the PUBLIC:ATTACH element automatically stop receiving notifications when the behavior detaches from the element, and thus do not need to call the detachEvent method.

Parameters

type:DOMString — Specifies any of the standard DHTML Events.
 
listener:Function — Specifies the function previously set using the attachEvent method.

See also


Example
This example calls the detachEvent method from an HTML Component (HTC) when the highlighting effect is removed from the page, causing the ondetach event to fire.
         <PUBLIC:ATTACH EVENT="ondetach" ONEVENT="cleanup()" />
         
         <script language="JScript">
         attachEvent ('onmouseover', Hilite);
         attachEvent ('onmouseout', Restore);
         
         function cleanup() {
             detachEvent ('onmouseover', Hilite);
             detachEvent ('onmouseout', Restore);
         }
         
         function Hilite() {
             if (event.srcElement == element) { 
                 normalColor = style.color;  
                 runtimeStyle.color  = "red";
                 runtimeStyle.cursor = "hand";
             }
         }
         
         function Restore() {
             if (event.srcElement == element) {
                 runtimeStyle.color  = normalColor;
                 runtimeStyle.cursor = "";
             }
         }
         </script>
doScroll()method 
public function doScroll(scrollAction:DOMString = scrollbarDown):void

Product Version : Internet Explorer 5.0

Non-standard

Simulates a click on a scroll-bar component.

Cascading Style Sheets (CSS) allow you to scroll on all objects through the overflow property.

When the content of an element changes and causes scroll bars to display, the doScroll method might not work correctly immediately following the content update. When this happens, you can use the setTimeout method to enable the browser to recognize the dynamic changes that affect scrolling.

Parameters

scrollAction:DOMString (default = scrollbarDown) — Specifies how the object scrolls, using one of the following values.
  • scrollbarDown : Default. Down scroll arrow is at the specified location.
  • scrollbarHThumb : Horizontal scroll thumb or box is at the specified location.
  • scrollbarLeft : Left scroll arrow is at the specified location.
  • scrollbarPageDown : Page-down scroll bar shaft is at the specified location.
  • scrollbarPageLeft : Page-left scroll bar shaft is at the specified location.
  • scrollbarPageRight : Page-right scroll bar shaft is at the specified location.
  • scrollbarPageUp : Page-up scroll bar shaft is at the specified location.
  • scrollbarRight : Right scroll arrow is at the specified location.
  • scrollbarUp : Up scroll arrow is at the specified location.
  • scrollbarVThumb : Vertical scroll thumb or box is at the specified location.
  • down : Composite reference to scrollbarDown.
  • left : Composite reference to scrollbarLeft.
  • pageDown : Composite reference to scrollbarPageDown.
  • pageLeft : Composite reference to scrollbarPageLeft.
  • pageRight : Composite reference to scrollbarPageRight.
  • pageUp : Composite reference to scrollbarPageUp.
  • right : Composite reference to scrollbarRight.
  • up : Composite reference to scrollbarUp.

dragDrop()method 
public function dragDrop():Boolean

Product Version : Internet Explorer 1.0

Non-standard

Initiates a drag event.

You can use this method to fire the ondragstart event. If the event is not cancelled, a drag operation is started. The method returns true when the mouse is released. If the ondragstart event is cancelled, the method returns false immediately

Returns
Boolean — Drag operation success
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

getAdjacentText()method 
public function getAdjacentText(where:DOMString):DOMString

Product Version : Internet Explorer 1.0

Non-standard

Returns the adjacent text string.

Parameters

where:DOMString — Specifies where the text is located by using one of the following values.
  • beforeBegin : Text is returned immediately before the element.
  • afterBegin : Text is returned after the start of the element but before all other content in the element.
  • beforeEnd : Text is returned immediately before the end of the element but after all other content in the element.
  • afterEnd : Text is returned immediately after the end of the element.

Returns
DOMString — Returns the first adjacent text string.
DOM 1 Core getAttribute()method 
public function getAttribute(name:DOMString):Object

Product Versions : Internet Explorer 5.0 Firefox 1.0 Opera 7.0 Safari 1.0
Introduced in:  

Returns the value of the named attribute on the specified element.

If the named attribute does not exist, the value returned will either be null or "" (the empty string).

Note: Essentially all web browsers (Firefox, Internet Explorer, recent versions of Opera, Safari, Konqueror, and iCab, as a non-exhaustive list) return null when the specified attribute does not exist on the specified element. The DOM specification says that the correct return value in this case is actually the empty string, and some DOM implementations implement this behavior. The implementation of getAttribute in XUL (Gecko) actually follows the specification and returns an empty string. Consequently, you should use hasAttribute to check for an attribute's existence prior to calling getAttribute() if it is possible that the requested attribute does not exist on the specified element.

The attributeName parameter is usually case sensitive, but it is case-insensitive when used upon HTML elements.

Parameters

name:DOMString

Returns
Object — The value or null/""

Example
         var div1 = document.getElementById("div1");
         var align = div1.getAttribute("align");
         alert(align); // shows the value of align for the element with id="div1"
DOM 2 Core getAttributeNode()method 
public function getAttributeNode(name:DOMString):Attr

Product Versions : Internet Explorer 6.0 Firefox 1.0 Opera 7.0 Safari 1.0
Introduced in:  

Returns the Attr node for the attribute with the given name.

Note: (IE8+) In IE8 mode, getAttributeNode correctly populates the value property of the returned attribute object regardless of whether the specified property is set to true or false. For more information on IE8 mode, see Defining Document Compatibility.

Note: (IE8+) In IE8 mode, the value property is correctly reported as a canonical attribute name. For example, <input type="text" readonly> and <input type="text" readonly="readonly"> would both set the input text field to read-only. In IE8 mode, the value is evaluated as a cannonical value, "readonly". In IE7 and earlier modes, it is evaluated as a Boolean value, true.

Parameters

name:DOMString — Specifies the name property of the requested attribute object.

Returns
Attr — Returns a reference to an attribute object.

See also

DOM 2 Core getAttributeNodeNS()method 
public function getAttributeNodeNS(nameSpace:DOMString, name:DOMString):Attr

Product Versions : Firefox 1.0 Opera 8.0
Introduced in: DOM 2 Core 

Returns the Attr node for the attribute with the given namespace and name.

Parameters

nameSpace:DOMString — Specifying the namespace of the attribute.
 
name:DOMString — Specifying the name of the attribute.

Returns
Attr — The node for specified attribute

Throws
DOMException — NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces.
DOM 2 Core getAttributeNS()method 
public function getAttributeNS(nameSpace:DOMString, name:DOMString):DOMString

Product Versions : Firefox 1.0 Opera 8.0
Introduced in: DOM 2 Core 

Returns the string value of the attribute with the specified namespace and name.

If the named attribute does not exist, the value returned will either be null or "" (the empty string).

Parameters

nameSpace:DOMString — The namespace of the specified attribute.
 
name:DOMString — The name of the specified attribute.

Returns
DOMString — The value or null/""

Throws
DOMException — NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [HTML 4.01]).

Example
         var div1 = document.getElementById("div1");
         var a = div1.getAttributeNS("www.mozilla.org/ns/specialspace/", "special-align");
         alert(a); // shows the value of align for that div
DOM 3 Core getBoundingClientRect()method 
public function getBoundingClientRect():TextRectangle

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.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in:  

Retrieves an object that specifies the bounds of a collection of TextRectangle objects.

Note (IE8): In IE8 mode, the bounding rectangle is the same as the client rectangle.

Note (IE5): In Microsoft Internet Explorer 5, the window's upper-left is at 2,2 (pixels) with respect to the true client.

Note (Firefox 3.5): Firefox 3.5 adds width and height properties to the TextRectangle object.

Note (Firefox): Firefox doesn't round the top/bottom coordinates.

Returns
TextRectangle — The returned value is a TextRectangle object which is the union of the rectangles returned by getClientRects() for the element, i.e., the CSS border-boxes associated with the element.

See also


Example
         var rects = obj.getClientRects();
         var numLines = rects.length;
DOM 3 Core getClientRects()method 
public function getClientRects():TextRectangleList

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.1b Safari 3.0 Safari 3.1 Safari 4.0b Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0a
Introduced in:  

Retrieves a collection of rectangles that describes the layout of the contents of an object or range within the client. Each rectangle describes a single line.

Note (IE8): In IE8 mode, getClientRects always returns a collection of one rectangle—the same rectangle as getBoundingClientRect.

Note (IE): In IE5-7, split up a block-level element such as a <p> into one rectangle per line. This is incorrect: a block-level element should be reported as one rectangle.

Note (IE): In IE5-7, the rectangles are off by about two pixels. According to John Resig this is caused by the (invisible, but nonetheless present) borders of the <html> element.

Note (Firefox 3.5): Firefox 3.5 adds width and height properties to the TextRectangle object.

Note (Firefox): Firefox doesn't round the top/bottom coordinates.

Returns
TextRectangleList

See also


Example
var rect = obj.getBoundingClientRect();
HTML 5 getElementsByClassName()method 
public function getElementsByClassName(name:DOMString):NodeList

Product Version : Firefox 3.0
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

name:DOMString — Specifies the name of a class.

Returns
NodeList — Returns a set of elements with the given class name.

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');
DOM 2 Core getElementsByTagName()method 
public function getElementsByTagName(name:DOMString):NodeList

Product Versions : Internet Explorer 5.0 Firefox 1.0 Opera 7.0 Safari 1.0
Introduced in: DOM 2 Core 

Retrieves a collection of objects based on the specified element name.

Parameters

name:DOMString — Specifies the name of an element.

Returns
NodeList — Returns a collection of objects with the specified element name.

Example
         // check the alignment on a number of cells in a table. 
         var table = document.getElementById("forecast-table"); 
         var cells = table.getElementsByTagName("td"); 
         for (var i = 0; i < cells.length; i++) { 
                 status = cells[i].getAttribute("status"); 
                 if ( status == "open") { 
                     // grab the data 
                 }
         }
DOM 2 Core getElementsByTagNameNS()method 
public function getElementsByTagNameNS(nameSpace:DOMString, localName:DOMString):NodeList

Product Versions : Firefox 1.0 Opera 8.0
Introduced in: DOM 2 Core 

Returns a list of elements with the given tag name belonging to the given namespace.

Parameters

nameSpace:DOMString — The namespace URI of elements to look for (see element.namespaceURI). For example, if you need to look for XHTML elements, use the XHTML namespace URI, http://www.w3.org/1999/xhtml.
 
localName:DOMString — Either the local name of elements to look for or the special value ", which matches all elements

Returns
NodeList

Throws
DOMException — NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces.
getExpression()method 
public function getExpression(propertyName:DOMString):*

Product Version : Internet Explorer 5.0

Non-standard

Retrieves the expression for the given property.

Parameters

propertyName:DOMString — Specifies the name of the property from which to retrieve the expression.

Returns
* — Returns a variant value representing the expression of the property.

Example
         <body>
         <span id="trueBlueSpan" style="background-color:lightblue; width:100px">
         The width of this blue span is set inline at 100 pixels.
         </span>
         <span id="oldYellowSpan" style="background-color:lightyellow; width:200px">
         The width of this yelllow span is set inline at 200 pixels.
         </span>
         <br>
         <span id="AlGreenSpan" style="background-color:lightgreen; width:expression(trueBlueSpan.style.pixelWidth + oldYellowSpan.style.pixelWidth)">
         Click the button below to see the expression used to set the width of this span.
         </span>
         <br>
         <button onclick=alert(AlGreenSpan.style.getExpression("width"));>See Expression</button>
         </body>
DOM 2 Core hasAttribute()method 
public function hasAttribute(name:DOMString):Boolean

Product Version : Firefox 1.0
Introduced in: DOM 2 Core 

DOM Level 2 | NS\FireFox Determines whether an attribute with the specified name exists.

Parameters

name:DOMString — Name of the attribute.

Returns
Boolean — If the attribute exists.

Example
         // check that the attribute exists before setting a value
         var d = document.getElementById("div1"); 
         if d.hasAttribute("align") { 
                 d.setAttribute("align", "center"); 
         }
DOM 2 Core hasAttributeNS()method 
public function hasAttributeNS(nameSpace:DOMString, name:DOMString):Boolean

Product Versions : Firefox 1.0 Opera 8.0 Safari 1.3
Introduced in: DOM 2 Core 

Returns a boolean value indicating whether the current element has the specified attribute.

Parameters

nameSpace:DOMString — Specifying the namespace of the attribute.
 
name:DOMString — Name of the attribute.

Returns
Boolean

Throws
DOMException — NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [HTML 4.01]).

Example
         // check that the attribute exists 
         // before you set a value 
         var d = document.getElementById("div1"); 
         if (d.hasAttributeNS("http://www.mozilla.org/ns/specialspace/", "special-align")) {
             d.setAttribute("align", "center");
         }
insertAdjacentElement()method 
public function insertAdjacentElement(where:DOMString, element:Element):Element

Product Version : Internet Explorer 1.0

Non-standard

Inserts an element at the specified location.

You cannot insert text while the document is loading. Wait for the onload event before attempting to call this method.

If you try to insert an object that already exists on the page, the existing object is moved to the point that you specified in the insertAdjacentElement method; no new object is created.

Parameters

where:DOMString — Specifies where to insert the HTML element, using one of the following values.
  • beforeBegin : Inserts element immediately before the object.
  • afterBegin : Inserts element after the start of the object, but before all other content in the object.
  • beforeEnd : Inserts element immediately before the end of the object, but after all other content in the object.
  • afterEnd : Inserts element immediately after the end of the object.
 
element:Element — Object that specifies the element to be inserted adjacent to the object that invoked the insertAdjacentElement method.

Returns
Element — Returns an element object.
insertAdjacentHTML()method 
public function insertAdjacentHTML(where:DOMString, text:DOMString):void

Product Version : Internet Explorer 4.0

Non-standard

Inserts the given HTML text into the element at the location.

If the text contains HTML tags, the method parses and formats the text as it is inserted.

You cannot insert text while the document is loading. Wait for the onload event to fire before attempting to call this method.

When using the insertAdjacentHTML method to insert script, you must include the DEFER attribute in the script element.

Parameters

where:DOMString — Specifies where to insert the HTML element, using one of the following values.
  • beforeBegin : Inserts text immediately before the object.
  • afterBegin : Inserts text after the start of the object, but before all other content in the object.
  • beforeEnd : Inserts text immediately before the end of the object, but after all other content in the object.
  • afterEnd : Inserts text immediately after the end of the object.
 
text:DOMString — Specifies the HTML text to insert. The string can be a combination of text and HTML tags. This must be well-formed, valid HTML or this method will fail.

insertAdjacentText()method 
public function insertAdjacentText(where:DOMString, text:DOMString):void

Product Version : Internet Explorer 1.0

Non-standard

Inserts the given text into the element at the specified location.

The text inserted into the element is plain text. You cannot insert text while the document loads. Wait for the onload event to fire before attempting to call this method.

Parameters

where:DOMString — Specifies where to insert the text, using one of the following values.
  • beforeBegin : Inserts text immediately before the object.
  • afterBegin : Inserts text after the start of the object, but before all other content in the object.
  • beforeEnd : Inserts text immediately before the end of the object, but after all other content in the object.
  • afterEnd : Inserts text immediately after the end of the object.
 
text:DOMString — Specifies the text to insert.

mergeAttributes()method 
public function mergeAttributes(source:Element, preserve:Boolean = true):void

Product Version : Internet Explorer 5.0

Non-standard

Copies all read/write attributes to the specified element.

The mergeAttributes method copies persistent HTML attributes, events, and styles.

IE Note: In Internet Explorer 5 and earlier, attributes that are read-only, such as ID, are not merged.

IE Note: As of Internet Explorer 5.5, by choosing not to preserve the identity of the destination object, you can merge all attributes of an object, including ID and NAME.

Parameters

source:Element — Pointer to an Object that specifies the attributes copied to the object that invokes mergeAttributes.
 
preserve:Boolean (default = true) — Available as of Microsoft Internet Explorer 5.5. Specifies whether to preserve the identity of the object to which attributes are being merged or not.

Selectors API querySelector()method 
public function querySelector(selectors:DOMString):Element

Introduced in:  

Returns the first element that is a descendent of the element on which it is invoked that matches the specified group of selectors.

Parameters

selectors:DOMString — One or more selectors

Returns
Element — The first matching Element node within the node’s subtree. If there is no such node, returns null.

See also


Example
         <html xmlns="http://www.w3.org/1999/xhtml">
             <head>
                 <title>Selectors API Example</title>
             </head>
             <body>
         
                 <div id="foo">
                     <p class="warning">This is a sample warning</p>
                     <p class="error">This is a sample error</p>
                 </div>
                 <div id="bar">
                     <p>...</p>
                 </div>
             </body>
         </html>
x would contain the first element in the document with an ID of either foo or bar (or both). In the sample document above, it would select the div element with the ID of foo because it is first in document order.
var x = document.querySelector("#foo, #bar");
Selectors API querySelectorAll()method 
public function querySelectorAll(selectors:DOMString):NodeList

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.5b4 Safari 3.0 Safari 3.1 Safari 4.0 Chrome 1.0 Chrome 2.0 Opera 9.62 Opera 10.0b
Introduced in:  

Returns a list of all elements descended from the element on which it is invoked that match the specified group of selectors.

Parameters

selectors:DOMString — One or more selectors

Returns
NodeList — A NodeList containing all of the matching Element nodes within the node’s subtree, in document order. If there are no such nodes, returns an empty NodeList.

See also


Example
         <html xmlns="http://www.w3.org/1999/xhtml">
             <head>
                 <title>Selectors API Example</title>
             </head>
             <body>
         
                 <div id="foo">
                     <p class="warning">This is a sample warning</p>
                     <p class="error">This is a sample error</p>
                 </div>
                 <div id="bar">
                     <p>...</p>
                 </div>
             </body>
         </html>
The following example would select all p elements in the document that have a class of either "error" or "warning".
var alerts = document.querySelectorAll("p.warning, p.error");
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>
DOM 1 Core removeAttribute()method 
public function removeAttribute(name:DOMString):void

Product Versions : Internet Explorer 4.0 Firefox 1.0 Opera 8.0 Safari 1.0
Introduced in: DOM 1 Core 

Removes an attribute from the specified element.

Note : You should use removeAttribute instead of setting the attribute value to null using setAttribute.

Parameters

name:DOMString — The name of the attribute to be removed from element.


Throws
DOMException — NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

Example
         // <div id="div1" align="left" width="200px">
         document.getElementById("div1").removeAttribute("align"); 
         // now: <div id="div1" width="200px">
DOM 1 Core removeAttributeNode()method 
public function removeAttributeNode(name:Attr):Attr

Product Versions : Internet Explorer 6.0 Firefox 1.0 Opera 8.0 Safari 1.0
Introduced in: DOM 1 Core 

Removes an attribute object from the object.

Parameters

name:Attr — The Attr node that needs to be removed.

Returns
Attr — Returns a reference to the removed attribute object.

Throws
DOMException — NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
 
DOMException — NOT_FOUND_ERR: Raised if oldAttr is not an attribute of the element.
DOM 2 Core removeAttributeNS()method 
public function removeAttributeNS(nameSpace:DOMString, name:DOMString):void

Product Versions : Firefox 1.0 Opera 8.0
Introduced in: DOM 2 Core 

Removes the specified attribute from an element.

FF Note : In Firefox 3 and later, this method resets DOM values to their defaults.

Parameters

nameSpace:DOMString — Contains the namespace of the attribute.
 
name:DOMString — The attribute to be removed from the current node.


Throws
DOMException — NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
 
DOMException — NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [HTML 4.01]).

Example
         // <div id="div1" xmlns:special="http://www.mozilla.org/ns/specialspace" special:specialAlign="utterleft" width="200px" /> 
         d = document.getElementById("div1"); 
         d.removeAttributeNS("http://www.mozilla.org/ns/specialspace", "specialAlign"); 
         // now: <div id="div1" width="200px" />
removeBehavior()method 
public function removeBehavior(id:Number):Boolean

Product Version : Internet Explorer 5.0

Non-standard

Detaches a behavior from the element.

This method applies only to attached behaviors, which are the original Dynamic HTML (DHTML) behaviors introduced in Microsoft Internet Explorer 5. Element behaviors are a feature in Internet Explorer 5.5 and cannot be added or removed from an element.

Parameters

id:Number — Specifies the identifier that is returned from a previous addBehavior call.

Returns
Boolean — If it was successfully removed.
removeExpression()method 
public function removeExpression(propertyName:DOMString):Boolean

Product Version : Internet Explorer 5.0

Non-standard

Removes the expression from the specified property.

After the expression is removed from the specified property, the value of the property equals the last computed value of the expression. To remove expressions set by the setExpression method, use removeExpression.

Parameters

propertyName:DOMString — Specifies the name of the property from which to remove an expression.

Returns
Boolean — If the expression was successfully removed.
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

replaceAdjacentText()method 
public function replaceAdjacentText(where:DOMString, replaceText:DOMString):DOMString

Product Version : Internet Explorer 1.0

Non-standard

Replaces the text adjacent to the element.

Parameters

where:DOMString — Specifies where to locate the replacement text, using one of the following values.
  • beforeBegin : Inserts text immediately before the object.
  • afterBegin : Inserts text after the start of the object, but before all other content in the object.
  • beforeEnd : Inserts text immediately before the end of the object, but after all other content in the object.
  • afterEnd : Inserts text immediately after the end of the object.
 
replaceText:DOMString — Specifies the replacement text.

Returns
DOMString — A pointer to a String returning the old text.
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()">
DOM 0 scrollIntoView()method 
public function scrollIntoView(alignToTop:Boolean = true):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.1b 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 

Causes the object to scroll into view, aligning it either at the top or bottom of the window.

The scrollIntoView method is useful for immediately showing the user the result of some action without requiring the user to manually scroll through the document to find the result.

Depending on the size of the given object and the current window, this method might not be able to put the item at the very top or very bottom, but will position the object as close to the requested position as possible.

Parameters

alignToTop:Boolean (default = true) — Whether to scroll the object so that top of the object is visible at the top of the window.


Example
         <html>
         <head>
         <title>ScrollIntoView() example</title>
         
         <script type="text/javascript">
         function showIt(elID) {
         var el = document.getElementById(elID);
         el.scrollIntoView(true);
         }
         </script>
         
         </head>
         <body>
             <div style="height: 5em; width: 30em; overflow: scroll; border: 1px solid blue;">
                 <div style="height: 100px"></div>
                 <p id="pToShow">The para to show</p>
                 <div style="height: 100px"></div>
             </div>
             <input type="button" value="Show para" onclick="showIt('pToShow');">
         </body>
setActive()method 
public function setActive():void

Product Version : Internet Explorer 5.5

Non-standard

Sets the object as active without setting focus to the object.

The setActive method does not cause the document to scroll to the active object in the current page or in another frame or window.


Example
         <script>
         function fnBottomActive() {
                 //Set the object with ID=btnLarger active in frame with ID=oFrame1.
                 window.parent.oFrame1.secondButton.setActive();
         }
         </script>
DOM 1 Core setAttribute()method 
public function setAttribute(name:DOMString, value:Number, caseSensitive:*):void

Product Versions : Internet Explorer 5.0 Firefox 1.0 Opera 8.0 Safari 1.0
Introduced in: DOM 1 Core 

Sets the value of the specified attribute.

IE Note: Internet Explorer 8 and later. IE8 mode enables several enhancements to the setAttribute, getAttribute, and removeAttribute methods that are not available when pages are displayed in earlier document modes.

The name parameter requires the name of the desired content attribute and not the Document Object Model (DOM) attribute. For example, in IE8 mode, this method no longer requires name to be "className" when setting, getting, or removing a CLASS attribute. Earlier versions of Internet Explorer and Internet Explorer 8 in compatibility mode still require name to specify the corresponding DOM property name.

The name parameter is not case sensitive. As a result, the caseSensitive parameter is no longer supported and should not be used.

The methods support event handlers. For example, the following code example defines an event handler to call a function called SomeFunction when the body of the page is loaded.

document.body.setAttribute('onload', 'SomeFunction()');

If the specified attribute is not already present, the setAttribute method adds the attribute to the object and sets the value.

If your pages are displayed in IE5 mode or IE7 mode, be careful when spelling attribute names. If you set iCaseSensitive to 1 and the name parameter does not have the same uppercase and lowercase letters as the attribute, a new attribute is created for the object. If two or more attributes have the same name, differing only in case, and iCaseSensitive is set to 0, this method assigns values only to the first attribute created with this name. All other attributes of the same name are ignored.

New for Internet Explorer 8 Internet Explorer 8 and later. When pages are displayed in IE8 mode, the vValue parameter only supports string values. Non-string values are not automatically converted to string values. For best results, formally convert values to strings before using them as parameter values. For example, do not attempt to pass an object directly to the vValue parameter; call the object's toString method instead.

Parameters

name:DOMString — Specifies the name of the attribute.
 
value:Number — Specifies the string, number, or Boolean to assign to the attribute.
 
caseSensitive:* — (IE Only) Specifies whether to use a case-sensitive search to locate the attribute. Can be one of the following values: 1 : The case of name is respected. 0 : Match name regardless of case.


Throws
DOMException — INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in the Document.xmlVersion attribute.
 
DOMException — NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
DOM 1 Core setAttributeNode()method 
public function setAttributeNode(attrNode:Attr):Attr

Product Versions : Internet Explorer 4.0 Firefox 1.0 Opera 8.0 Safari 1.0
Introduced in: DOM 1 Core 

Sets an attribute object node as part of the object.

If the attribute named already exists on the element, that attribute is replaced with the new one and the replaced one is returned.

Parameters

attrNode:Attr — Attribute object to be assigned.

Returns
Attr — Returns a reference to the removed attribute object.

Throws
DOMException — WRONG_DOCUMENT_ERR: Raised if newAttr was created from a different document than the one that created the element.
 
DOMException — NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
 
DOMException — INUSE_ATTRIBUTE_ERR: Raised if newAttr is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.

Example
         // <div id="one" align="left">one</div> 
         // <div id="two">two</div> 
         var d1 = document.getElementById("one"); 
         var d2 = document.getElementById("two"); 
         var a = d1.getAttributeNode("align"); 
         d2.setAttributeNode(a.cloneNode(true)); 
         alert(d2.attributes[1].value) 
         // returns: `left'
DOM 2 Core setAttributeNodeNS()method 
public function setAttributeNodeNS(attrNode:Attr):void

Product Versions : Firefox 1.0 Opera 8.0
Introduced in: DOM 2 Core 

Adds a new attribute node with the specified namespace and name.

If the specified attribute already exists on the element, then that attribute is replaced with the new one and the replaced one is returned.

Note: If you try to set without cloning the node, Mozilla gives an NS_ERROR_DOM_INUSE_ATTRIBUTE_ERR "Attribute already in use" error, as the DOM requires cloning for Attr to be reused (unlike other Nodes which can be moved).

Parameters

attrNode:Attr — Attribute object to be assigned.


Throws
DOMException — WRONG_DOCUMENT_ERR: Raised if newAttr was created from a different document than the one that created the element.
 
DOMException — NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
 
DOMException — INUSE_ATTRIBUTE_ERR: Raised if newAttr is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.
 
DOMException — NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [HTML 4.01]).

Example
         // <div id="one" xmlns:myNS="http://www.mozilla.org/ns/specialspace" myNS:special-align="utterleft">one</div> 
         // <div id="two">two</div> 
         
         var myns = "http://www.mozilla.org/ns/specialspace"; 
         var d1 = document.getElementById("one"); 
         var d2 = document.getElementById("two"); 
         var a = d1.getAttributeNodeNS(myns, "special-align"); 
         d2.setAttributeNodeNS(a.cloneNode(true));
         alert(d2.attributes[1].value) // returns: `utterleft'
DOM 2 Core setAttributeNS()method 
public function setAttributeNS(nameSpace:DOMString, name:DOMString, value:*):void

Product Versions : Firefox 1.0 Opera 8.0
Introduced in: DOM 2 Core 

Adds a new attribute or changes the value of an attribute with the given namespace and name.

Parameters

nameSpace:DOMString — Specifying the namespace of the attribute.
 
name:DOMString — The attribute to be set.
 
value:* — The desired string value of the new attribute.


Throws
DOMException — INVALID_CHARACTER_ERR: Raised if the specified qualified name is not an XML name according to the XML version in use specified in the Document.xmlVersion attribute.
 
DOMException — NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
 
DOMException — NAMESPACE_ERR: Raised if the qualifiedName is malformed per the Namespaces in XML specification, if the qualifiedName has a prefix and the namespaceURI is null, if the qualifiedName has a prefix that is "xml" and the namespaceURI is different from "http://www.w3.org/XML/1998/namespace", if the qualifiedName or its prefix is "xmlns" and the namespaceURI is different from "http://www.w3.org/2000/xmlns/", or if the namespaceURI is "http://www.w3.org/2000/xmlns/" and neither the qualifiedName nor its prefix is "xmlns".
 
DOMException — NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [HTML 4.01]).

Example
         var d = document.getElementById("d1");
         d.setAttributeNS("http://www.mozilla.org/ns/specialspace", "align", "center");
setCapture()method 
public function setCapture(containerCapture:Boolean = true):void

Product Version : Internet Explorer 5.0

Non-standard

Sets the mouse capture to the object that belongs to the current document.

After mouse capture is set to an object, all mouse events for the document are routed to that object. Supported mouse events include onmousedown, onmouseup, onmousemove, onclick, ondblclick, onmouseover, and onmouseout. The srcElement property of the window event object always returns the object that is positioned under the mouse, instead of the object that has mouse capture.

Mouse clicks automatically trigger the onlosecapture event. To retain mouse capture, call setCapture inside the onclick event handler. Mouse capture is also lost if the browser window loses focus for any reason (including alerts or pop-up windows).

When the containerCapture parameter is set to true, a container object, such as a div, captures mouse events for all objects in it. By passing the value false, objects in that container can fire events, and cancel event bubbling.

Drag-and-drop operations, such as the ondragstart event, and text selection through the user interface are disabled when mouse capture is set programmatically. The following key events are unaffected by mouse capture and fire as usual: onkeydown, onkeyup, and onkeypress.

Parameters

containerCapture:Boolean (default = true) — (IE 5.5+) Whether events originating in a container are captured by the container.


Example
         <BODY onload="oOwnCapture.setCapture()" onclick="document.releaseCapture()">
         <DIV ID=oOwnCapture STYLE="background-color:#ccc;padding:6pt"
         onmousemove="oWriteLocation.value = event.x + ':' + event.y";
         onlosecapture="alert(event.srcElement.id + ' lost mouse capture.')">
         <P>Mouse capture has been set to this gray division (DIV) 
         at load time using the setCapture method. The text area will 
         track the mousemove event through the <B>x</B> 
         and <B>y</B> properties of the event object.<BR>
         <P>Event bubbling works as usual on objects within a 
         container that has mouse capture. Demonstrate this concept by 
         clicking the button below or changing the active window from 
         this one and then back. After oOwnCapture loses mouse capture, 
         the text area continues tracking the mousemove events only 
         while the cursor is over objects it contains.</P>
         <BR><BR>
         <TEXTAREA ID=oWriteLocation COLS=9> </TEXTAREA>
         </DIV>
         <HR>
         <DIV ID=oNoCapture>
         <P>This white division is here to illustrate that mousemove 
         events over objects it contains are captured on the gray 
         division, oOwnCapture.
         <INPUT VALUE="Move mouse over this object.">
         <BUTTON>Click Anywhere to End Mouse Capture</BUTTON>
         </DIV>
         </BODY>
setExpression()method 
public function setExpression(propertyName:DOMString, expression:DOMString, language:DOMString):void

Product Version : Internet Explorer 5.0

Non-standard

Sets an expression for the specified object.

Use the setExpression method to add expressions to supported Cascading Style Sheets (CSS) attributes and read/write DHTML Properties. To remove expressions set by setExpression, use the removeExpression method.

Parameters

propertyName:DOMString — Specifies the name of the property to which sExpression is added.
 
expression:DOMString — Specifies any valid script(JScript, JavaScript, VBSCript) statement without quotations or semicolons. This string can include references to other properties on the current page. Array references are not allowed on object properties included in this script.
 
language:DOMString — Specifies one of the following values:
  • JScript : Default. Language is JScript.
  • VBScript : Language is VBScript.
  • JavaScript : Language is JavaScript.

DOM 3 Core setIdAttribute()method 
public function setIdAttribute(name:DOMString, isId:Boolean):void

Introduced in:  

If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute. This affects the value of Attr.isId and the behavior of Document.getElementById, but does not change any schema that may be in use, in particular this does not affect the Attr.schemaTypeInfo of the specified Attr node. Use the value false for the parameter isId to undeclare an attribute for being a user-determined ID attribute. To specify an attribute by local name and namespace URI, use the setIdAttributeNS method.

Parameters

name:DOMString — The name of the attribute.
 
isId:Boolean — Whether the attribute is a of type ID.


Throws
DOMException — NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
 
DOMException — NOT_FOUND_ERR: Raised if the specified node is not an attribute of this element.
DOM 3 Core setIdAttributeNode()method 
public function setIdAttributeNode(idAttr:Attr, isId:Boolean):void

Introduced in:  

If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute. This affects the value of Attr.isId and the behavior of Document.getElementById, but does not change any schema that may be in use, in particular this does not affect the Attr.schemaTypeInfo of the specified Attr node. Use the value false for the parameter isId to undeclare an attribute for being a user-determined ID attribute.

Parameters

idAttr:Attr — The attribute node.
 
isId:Boolean — Whether the attribute is a of type ID.


Throws
DOMException — NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
 
DOMException — NOT_FOUND_ERR: Raised if the specified node is not an attribute of this element.
DOM 3 Core setIdAttributeNS()method 
public function setIdAttributeNS(nameSpaceURI:DOMString, name:DOMString, isId:Boolean):void

Introduced in:  

If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute. This affects the value of Attr.isId and the behavior of Document.getElementById, but does not change any schema that may be in use, in particular this does not affect the Attr.schemaTypeInfo of the specified Attr node. Use the value false for the parameter isId to undeclare an attribute for being a user-determined ID attribute.

Parameters

nameSpaceURI:DOMString — The namespace URI of the attribute.
 
name:DOMString — The name of the attribute.
 
isId:Boolean — Whether the attribute is a of type ID.


Throws
DOMException — NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
 
DOMException — NOT_FOUND_ERR: Raised if the specified node is not an attribute of this element.
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()">
Event Detail
abort Event
Event Object Type: dom.events.Event
Event.type property = abort

Loading of a resource has been aborted.

blur Event  
Event Object Type: dom.events.UIEvent
UIEvent.type property = blur

An event target loses focus. The focus is taken from the element before the dispatch of this event type.

change Event  
Event Object Type: dom.events.Event
Event.type property = change

A control loses the input focus and its value has been modified since gaining focus. This event type is dispatched before the event type blur.

click Event  
Event Object Type: dom.events.MouseEvent
MouseEvent.type property = click

A pointing device button is clicked over an element. The definition of a click depends on the environment configuration; i.e. it may depend on the screen location or the delay between the press and release of the pointing device button. In any case, the event target must be the same between the mousedown, mouseup, and click. The sequence of these events is: mousedown, mouseup, and click. It depends on the environment configuration whether the event type click can occur if one or more of the event types mouseover, mousemove, and mouseout occur between the press and release of the pointing device button. In addition, the event type is dispatched as described in Activation requests and behavior.

dblclick Event  
Event Object Type: dom.events.MouseEvent
MouseEvent.type property = dblclick

A pointing device button is clicked twice over an element. The definition of a double click depends on the environment configuration, except that the event target must be the same between mousedown, mouseup, and dblclick. This event type is dispatched after the event type click if a click and double click occur simultaneously, and after the event type mouseup otherwise.

DOMActivate Event  
Event Object Type: dom.events.UIEvent
UIEvent.type property = DOMActivate

Refer to Activation requests and behavior.

DOMAttributeNameChanged Event  
Event Object Type: dom.events.MutationNameEvent
MutationNameEvent.type property = DOMAttributeNameChanged

Occurs after the namespaceURI and/or the nodeName of a Attr node have been modified (e.g., the attribute was renamed using Document.renameNode()). The target node of this event is the Element node whose Attr has been renamed.

DOMAttrModified Event  
Event Object Type: dom.events.MutationEvent
MutationEvent.type property = DOMAttrModified

Occurs after Attr.value has been modified and after an Attr node has been added to or removed from an Element. The target node of this event is the Element node where the change occured. It is implementation dependent whether this event type occurs when the children of the Attr node are changed in ways that do not affect the value of Attr.value.

DOMContentLoaded Event  
Event Object Type: dom.events.UIEvent
UIEvent.type property = DOMContentLoaded

Gecko-Specific Fired on a Window object when a document's DOM content is finished loading, but unlike "load", does not wait until all images are loaded. Used for example by GreaseMonkey to sneak in to alter pages before they are displayed. This event, as many others on this page, is dispatched to "trusted" targets only; for example, it is not dispatched to the content of the main browser object in Firefox, even if it comes from a chrome:/ URI.

DOMElementNameChanged Event  
Event Object Type: dom.events.MutationNameEvent
MutationNameEvent.type property = DOMElementNameChanged

Occurs after the namespaceURI and/or the nodeName of an Element node have been modified (e.g., the element was renamed using Document.renameNode()). The target node of this event is the renamed Element node.

DOMFocusIn Event  
Event Object Type: dom.events.UIEvent
UIEvent.type property = DOMFocusIn

An event target receives focus. The focus is given to the element before the dispatch of this event type. This event type is dispatched after the event type focus.

DOMFocusOut Event  
Event Object Type: dom.events.UIEvent
UIEvent.type property = DOMFocusOut

An event target loses focus. The focus is taken from the element before the dispatch of this event type. This event type is dispatched after the event type blur.

DOMFrameContentLoaded Event  
Event Object Type: dom.events.UIEvent
UIEvent.type property = DOMFrameContentLoaded

Gecko-Specific Same as DOMContentLoaded, but also fired for enclosed frames.

DOMLinkAdded Event  
Event Object Type: dom.events.UIEvent
UIEvent.type property = DOMLinkAdded

Gecko-Specific Undocumented

See also

DOMLinkRemoved Event  
Event Object Type: dom.events.UIEvent
UIEvent.type property = DOMLinkRemoved

Gecko-Specific Undocumented

See also

DOMMenuItemActive Event  
Event Object Type: dom.events.UIEvent
UIEvent.type property = DOMMenuItemActive

Gecko-Specific Undocumented

See also

DOMModalDialogClosed Event  
Event Object Type: dom.events.UIEvent
UIEvent.type property = DOMModalDialogClosed

Gecko-Specific Undocumented

See also

DOMMouseScroll Event  
Event Object Type: gecko.events.MouseEvent
MouseEvent.type property = DOMMouseScroll

Gecko-Specific The DOMMouseScroll event is sent when the mouse wheel is moved. The target of this event is the element that was under the mouse pointer when the mouse wheel was scrolled, similar to the click event.

DOMNodeInserted Event  
Event Object Type: dom.events.MutationEvent
MutationEvent.type property = DOMNodeInserted

A node has been added as a child of another node or, in case of Attr nodes, has been added to an Element. This event is dispatched after the insertion has taken place. The target node of this event is the node being inserted.

DOMNodeInsertedIntoDocument Event  
Event Object Type: dom.events.MutationEvent
MutationEvent.type property = DOMNodeInsertedIntoDocument

A node has been inserted into a document, either through direct insertion of the node or insertion of a subtree in which it is contained; Attr nodes are considered part of an Element's subtree. This event is dispatched after the insertion has taken place. The target node of this event is the node being inserted. If the node is being directly inserted, the event type DOMNodeInserted occurs before this event type.

DOMNodeRemoved Event  
Event Object Type: dom.events.MutationEvent
MutationEvent.type property = DOMNodeRemoved

A node is being removed from its parent node or, in case of Attr nodes, removed from its ownerElement. This event is dispatched before the removal takes place. The target node of this event is the node being removed.

DOMNodeRemovedFromDocument Event  
Event Object Type: dom.events.MutationEvent
MutationEvent.type property = DOMNodeRemovedFromDocument

A node is being removed from a document, either through direct removal of the node or removal of a subtree in which it is contained; Attr nodes are considered part of an Element's subtree. This event is dispatched before the removal takes place. The target node of this event type is the node being removed. If the node is being directly removed, the event type DOMNodeRemoved occurs before this event type.

DOMSubtreeModified Event  
Event Object Type: dom.events.MutationEvent
MutationEvent.type property = DOMSubtreeModified

This is a general event for notification of all changes to the document. It can be used instead of the more specific mutation and mutation name events listed below. It may be dispatched after a single modification to the document or, at the implementation's discretion, after multiple changes have occurred. The latter use should generally be used to accommodate multiple changes which occur either simultaneously or in rapid succession. The target of this event is the lowest common parent of the changes which have taken place. This event is dispatched after any other events caused by the mutation(s) have occurred.

DOMTitleChanged Event  
Event Object Type: dom.events.UIEvent
UIEvent.type property = DOMTitleChanged

Gecko-Specific Undocumented

See also

DOMWillOpenModalDialog Event  
Event Object Type: dom.events.UIEvent
UIEvent.type property = DOMWillOpenModalDialog

Gecko-Specific Undocumented

See also

DOMWindowClose Event  
Event Object Type: dom.events.UIEvent
UIEvent.type property = DOMWindowClose

Gecko-Specific Fired when the window is about to be closed by window.close().

error Event  
Event Object Type: dom.events.Event
Event.type property = error

A resource failed to load, or has been loaded but cannot be interpreted according to its semantics such as an invalid image, a script execution error, or non-well-formed XML.

focus Event  
Event Object Type: dom.events.UIEvent
UIEvent.type property = focus

An event target receives focus. The focus is given to the element before the dispatch of this event type.

fullscreen Event  
Event Object Type: dom.events.UIEvent
UIEvent.type property = fullscreen

Gecko-Specific Undocumented

See also

keydown Event  
Event Object Type: dom.events.KeyboardEvent
KeyboardEvent.type property = keydown

A key is pressed down. This event type is device dependent and relies on the capabilities of the input devices and how they are mapped in the operating system. This event type is generated after the keyboard mapping but before the processing of an input method editor. This event should logically happen before the event keyup is produced. Whether a keydown contributes or not to the generation of a text event is implementation dependent.

keyup Event  
Event Object Type: dom.events.KeyboardEvent
KeyboardEvent.type property = keyup

A key is released. This event type is device dependent and relies on the capabilities of the input devices and how they are mapped in the operating system. This event type is generated after the keyboard mapping but before the processing of an input method editor. This event should logically happen after the event keydown is produced. Whether a keyup contributes or not to the generation of a text event is implementation dependent.

load Event  
Event Object Type: dom.events.Event
Event.type property = load

The DOM Implementation finishes loading the resource (such as the document) and any dependent resources (such as images, style sheets, or scripts). Dependent resources that fail to load will not prevent this event from firing if the resource that loaded them is still accessible via the DOM. If this event type is dispatched, implementations are required to dispatch this event at least on the Document node.

mousedown Event  
Event Object Type: dom.events.MouseEvent
MouseEvent.type property = mousedown

A pointing device button is pressed over an element.

mousemove Event  
Event Object Type: dom.events.MouseEvent
MouseEvent.type property = mousemove

A pointing device is moved while it is over an element.

mousemultiwheel Event  
Event Object Type: dom.events.MouseMultiWheelEvent
MouseMultiWheelEvent.type property = mousemultiwheel

A mouse wheel has been rotated. A default action of user agent generated event objects of this type causes implementations to dispatch a mousewheel event iff it supports that event type and MouseMultiWheelEvent.wheelDeltaY is non-zero.

mouseout Event  
Event Object Type: dom.events.MouseEvent
MouseEvent.type property = mouseout

A pointing device is moved away from an element.

mouseover Event  
Event Object Type: dom.events.MouseEvent
MouseEvent.type property = mouseover

A pointing device is moved onto an element.

mouseup Event  
Event Object Type: dom.events.MouseEvent
MouseEvent.type property = mouseup

A pointing device button is released over an element.

mousewheel Event  
Event Object Type: dom.events.MouseWheelEvent
MouseWheelEvent.type property = mousewheel

A mouse wheel has been rotated around the y-axis.

MozAfterPaint Event  
Event Object Type: gecko.events.UIEvent
UIEvent.type property = MozAfterPaint

Gecko-Specific | Firefox 3.5+ The MozAfterPaint event is fired whenever content is repainted. It is sent to the document and bubbles up to the window level.

See also

MozMousePixelScroll Event  
Event Object Type: gecko.events.MouseEvent
MouseEvent.type property = MozMousePixelScroll

Gecko-Specific | Firefox 3.5+ Regular mouse wheels can only scroll with a per-line resolution. However, there are also devices that support scrolling with pixel precision, notably Apple MacBook trackpads. When we started supporting pixel scrolling in bug 350471, we added the MozMousePixelScroll event. It basically works exactly like DOMMouseScroll, with the difference that the detail attribute is in pixels (instead of lines). For backwards compatibility DOMMouseScroll events are sent even if pixel scrolling is used. Every DOMMouseScroll event can have several associated MozMousePixelScroll events. If preventDefault() is called on the DOMMouseScroll event, the following associated MozMousePixelScroll events won't cause any scrolling. When you listen for MozMousePixelScroll events, you shouldn't handle DOMMouseScroll events - otherwise you'd end up processing the same scroll gesture twice. In order to make it possible to only listen for MozMousePixelScroll events, Gecko will send MozMousePixelScroll events even when scrolling with regular mouse wheels. These events will carry a meaningful pixel delta.

PluginNotFound Event  
Event Object Type: dom.events.UIEvent
UIEvent.type property = PluginNotFound

Gecko-Specific Undocumented

See also

PopupWindow Event  
Event Object Type: dom.events.UIEvent
UIEvent.type property = PopupWindow

Gecko-Specific Undocumented

See also

reset Event  
Event Object Type: dom.events.Event
Event.type property = reset

A form, such as a [HTML 4.01] or [XHTML 1.0] form, is reset.

resize Event  
Event Object Type: dom.events.Event
Event.type property = resize

A document view or an element has been resized. The resize occured before the dispatch of this event type.

scroll Event  
Event Object Type: dom.events.Event
Event.type property = scroll

A document view or an element has been scrolled. The scroll occured before the dispatch of this event type.

select Event  
Event Object Type: dom.events.Event
Event.type property = select

A user selects some text. DOM Level 3 Events does not provide contextual information to access the selected text. The selection occured before the dispatch of this event type.

submit Event  
Event Object Type: dom.events.Event
Event.type property = submit

A form, such as a [HTML 4.01] or [XHTML 1.0] form, is submitted.

textInput Event  
Event Object Type: dom.events.TextEvent
TextEvent.type property = textInput

One or more characters have been entered. The characters can originate from a variety of sources. For example, it could be characters resulting from a key being pressed or released on a keyboard device, characters resulting from the processing of an input method editor, or resulting from a voice command. Where a "paste" operation generates a simple sequence of characters, i.e. a text without any structure or style information, this event type should be generated as well.

unload Event  
Event Object Type: dom.events.Event
Event.type property = unload

The DOM implementation removes from the environment the resource (such as the document) or any dependent resources (such as images, style sheets, scripts). The document is unloaded after the dispatch of this event type. If this event type is dispatched, implementations are required to dispatch this event at least on the Document node.

ValueChange Event  
Event Object Type: dom.events.UIEvent
UIEvent.type property = ValueChange

Gecko-Specific Undocumented

See also

windowZLevel Event  
Event Object Type: dom.events.UIEvent
UIEvent.type property = windowZLevel

Gecko-Specific Undocumented

See also