Browser/User Agent Support
| IE | Mozilla | Netscape | Opera | Safari | Netscapte | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ | no |
|---|
Constructors
| Constructor | IE | Mozilla | Netscape | Opera | Safari | Netscapte |
|---|---|---|---|---|---|---|
HTMLElement is the parent class of all HTML elements. | 3.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ | no |
Properties
| Property | IE | Mozilla | Netscape | Opera | Safari | Netscapte |
|---|---|---|---|---|---|---|
Character for the hotkey that gives focus to the element. | 4.0+ | no | no | no | no | no |
Array of all of the elements in the element. | 4.0+ | no | no | no | no | no |
Alignment property for the element. Used for display elements. (e.g. "center") | 4.0+ | no | no | no | no | no |
Array of attributes for the element. | 5.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
Gets or sets a time delay to lapse before the element starts "playing". | 5.5+ | no | no | no | no | no |
Array of behaviors attached to the element. | 5.0+ | no | no | no | no | no |
If true, indicates that the element can have child nodes. | 5.0+ | no | no | no | no | no |
If true, indicates that the element can contain HTML tags. | 5.5+ | no | no | no | no | no |
Array of the child nodes of the element. | 5.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
Array of the child nodes of the element. | 4.0+ | no | no | 8.0+ | 1.3+ | no |
Name of the CSS class that the element belongs to. | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
Height of the content of the element (in pixels). | 4.0+ | 1.0+ | 7.0+ | 7.0+ | 1.0+ | no |
Number of pixels between the offsetLeft property of the element and the start of the content of the element. | 4.0+ | no | no | no | no | no |
Number of pixels between the offsetTop property of the element and the top of the content of the element. | 4.0+ | no | no | no | no | no |
Width of the content of the element (in pixels). | 4.0+ | 1.0+ | 7.0+ | 7.0+ | 1.0+ | no |
Indicates whether the content of the element is editable. Possible values are "inherit", "true", or "false". | 5.5+ | no | no | no | no | no |
Reference to the Style object specifying the styles applied to the element. | 5.0+ | no | no | no | no | no |
Direction of the text in the element. Possible values are "ltr" (left-to-right) or "rtl" (right-to-left). | 5.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
If true, indicates that the element is disabled. | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
Reference to the parent Document object for the element. | 4.0+ | no | no | no | no | no |
Array of Microsoft CSS filters on the element. | 5.5+ | no | no | no | no | no |
Reference to the first child element of the element, if one exists. | 5.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
If true, indicates that the element is an HTML+TIME media element. | 5.5+ | no | no | no | no | no |
If true, the element does not give any visual cues to indicate when it has focus. | 5.5+ | no | no | no | no | no |
Unique identifier for the element. | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
HTML content within the tags of the element. | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
| ||||||
Text string enclosed by the tags of the element. Any HTML tags will be interpreted as part of the text string, not as HTML. | 4.0+ | no | 6.0+ | 7.0+ | 1.0+ | no |
If true, indicates that the user can edit the contents of the element. | 5.5+ | no | no | no | no | no |
If true, indicates that the element is disabled from user interaction. | 5.5+ | no | no | no | no | no |
If true, indicates that a TextRange object can be created using the element. | 4.0+ | no | no | no | no | no |
Language code for the content of the element. | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
| 4.0+ | no | no | no | no | no | |
Reference to the last child element of the element, if it exists. | 5.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
Local XML name for the element. | no | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
The XML Namespace URI for the element. | no | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
Reference to the next sibling element of the element. | 5.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
Name of the element tag. | 5.0+ | 1.0+ | 6.0+ | 8.0+ | 1.3+ | no |
Node type for the element. See Remarks for full explanation. | 5.5+ | 1.0+ | 6.0+ | 8.0+ | 1.3+ | no |
| ||||||
Value of the element. | 5.0+ | 1.0+ | 6.0+ | 8.0+ | 1.3+ | no |
Height of the element (in pixels). | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
Number of pixels the left edge of the element is offset from the left edge of its parent element. | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
Reference to the parent object corresponding with the offsetHeight, offsetWidth, offsetLeft, and offsetTop properties. | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
Number of pixels the top edge of the element is offset from the top edge of its parent element. | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
Width of the element (in pixels). | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
Fires when the element becomes active. | 4.0+ | no | no | no | no | no |
Fires immediately before the selection is copied to the clipboard. | 4.0+ | no | no | no | 1.0+ | no |
Fires immediately before the selection is cut to the clipboard. | 4.0+ | no | no | no | 1.0+ | no |
Fires immediately before the element stops being the active element. | 4.0+ | no | no | no | no | no |
Fires immediately before the element receives focus prior to being edited. | 4.0+ | no | no | no | no | no |
Fires immediately before the selection is pasted from the clipboard to the element. | 4.0+ | no | no | no | 1.0+ | no |
Fires when the element loses focus. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ | no |
Fires when the element is clicked. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ | no |
Fires when the element is right-clicked and the context menu opens. | 4.0+ | no | no | no | 1.0+ | no |
Fires immediately before the element is selected. | 4.0+ | no | no | no | no | no |
Fires when the element is copied to the clipboard. | 4.0+ | no | no | no | 1.0+ | no |
Fires when the element is cut to the clipboard. | 4.0+ | no | no | no | 1.0+ | no |
Fires when the element is double-clicked. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ | no |
Fires when the active element becomes inactive. | 4.0+ | no | no | no | no | no |
Fires when the element is dragged. | 4.0+ | no | no | no | 1.0+ | no |
Fires when the element is released from being dragged. | 4.0+ | no | no | no | 1.0+ | no |
Fires when the element has another object dragged onto it that can be dropped on the element. | 4.0+ | no | no | no | 1.0+ | no |
Fires when an element has an object dragged out of it that could be dropped onto the element. | 4.0+ | no | no | no | 1.0+ | no |
Fires when an element has an object dragged over it that could be dropped onto the element. | 4.0+ | no | no | no | 1.0+ | no |
Fires immediately before an element is dragged. | 4.0+ | no | no | no | 1.0+ | no |
Fires when an object is dropped onto the element. | 4.0+ | no | no | no | 1.0+ | no |
Fires when the CSS Filter of an element changes or finishes transitioning. | 4.0+ | no | no | no | no | no |
Fires when the element receives focus. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ | no |
Fires when a user presses the F1 key to activate help. | 4.0+ | no | no | no | no | no |
Fires when a user presses down on a key while the element has focus. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ | no |
Fires when a user presses a key or holds down the key while the element has focus. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ | no |
Fires when a user releases a key while the element has focus. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ | no |
Fires when the element loses mouse capture. | 4.0+ | no | no | no | no | no |
Fires when a user clicks down on the mouse button while the element has focus. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ | no |
Fires when the mouse pointer enters the element. | 4.0+ | no | no | no | no | no |
Fires when the mouse pointer leaves the element. | 4.0+ | no | no | no | no | no |
Fires when the mouse moves while the pointer over the element. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ | no |
Fires when the mouse pointer moves off of the element. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ | no |
Fires when the mouse pointer moves over the element. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ | no |
Fires when the user releases the mouse button while the element has focus. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+ | no |
Fires when the clipboard contents are pasted onto the element. | 4.0+ | no | no | no | 1.0+ | no |
Fires when one of the properties of the element changes. | 4.0+ | no | no | no | no | no |
Fires when the ready state of the element changes. | 4.0+ | no | no | no | no | no |
Fires immediately before an element is about to be resized. | 4.0+ | no | no | no | 1.0+ | no |
Fires when the element is finished being resized. | 4.0+ | no | no | no | no | no |
Fires immediately before a user resizes the element. | 4.0+ | no | no | no | no | no |
Fires immediately before the element is selected. | 4.0+ | no | no | no | 1.0+ | no |
HTML mark-up for an element, including start and end tags and any content between the tags. | 4.0+ | no | no | 8.0+ | 1.3+ | no |
Plain text for an element, including start and end tags. | 4.0+ | no | no | 8.0+ | 1.3+ | no |
Reference to the document that contains the element. | 6.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
Reference to the direct parent element of the element. | 4.0+ | no | no | no | no | no |
Reference to the direct parent node of the element, if it exists. | 4.0+ | 1.0+ | 6.0+ | 4.0+ | 1.0+ | no |
Reference to the closest parent element to the current element that can create a TextRange that contains the current element. | 4.0+ | no | no | no | no | no |
Prefix XML name for the element. | no | 1.0+ | no | 4.0+ | 1.0+ | no |
Reference to the previous sibling element of the element, if it exists. | 5.0+ | 1.0+ | 6.0+ | 4.0+ | 1.0+ | no |
Current readiness state of the element. See Remarks for possible values. | 4.0+ | no | no | no | no | no |
Record number for the data set that generated the element. | 4.0+ | no | no | no | no | no |
Reference to the Style object specifying the current runtime style(s) of the element. | 5.0+ | no | no | no | no | no |
XML scope of the element. | 5.0+ | no | no | no | no | no |
Height (in pixels) of the total content area of the element. | 4.0+ | 1.0+ | 7.0+ | 7.0+ | 1.0+ | no |
Number of pixels between the actual left edge of the element to the displayed left edge of the element. | 4.0+ | 1.0+ | 7.0+ | 7.0+ | 1.0+ | no |
Number of pixels between the actual top edge of the element to the displayed top edge of the element. | 4.0+ | 1.0+ | 7.0+ | 7.0+ | 1.0+ | no |
Width (in pixels) of the total content area of the element. | 4.0+ | 1.0+ | 7.0+ | 7.0+ | 1.0+ | no |
Index of the element in the Document.all[] array. | 4.0+ | no | no | 8.0+ | no | no |
Reference to the inline CSS style for the element. | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
If true, indicates that the time container of the element must synchronize playback with the element. Default is false. | 5.5+ | no | no | no | no | no |
Indicates the tab order index for the element. | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
HTML tag name for the element. | 4.0+ | 1.0+ | 6.0+ | 8.0+ | 1.3+ | no |
URN for the XML Namespace of the element. | 5.0+ | no | no | no | no | no |
Gets or sets the type of timeline that corresponds to the element. | 5.5+ | no | no | no | no | no |
Value of the title attribute for the element. | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
System-generated unique identifier for the element. | 5.5+ | no | no | no | no | no |
Methods
| Method | IE | Mozilla | Netscape | Opera | Safari | Netscapte |
|---|---|---|---|---|---|---|
Attaches a behavior to the element as specified in url. | 5.0+ | no | no | no | no | no |
Attaches an event listener to an HTMLElement that executes a function when the specified event occurs. | no | 1.0+ | no | 7.0+ | 1.0+ | no |
Appends a child element to the end of the childNodes[] array for the element. | 5.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
| ||||||
Adds a new element to the current element either as a child or parent of the current element. | 5.5+ | no | no | no | no | no |
Attaches the specified event handler and function to the element so that every time the event fires, the function is called. | 5.0+ | no | no | 8.0+ | no | no |
Removes focus from the element. | 5.0+ | 1.0+ | 3.0+ | 7.0+ | 1.0+ | no |
Removes all attributes and values from the element. | 5.0+ | no | no | no | no | no |
Simulates a mouse click on the element. Fires the onclick event. | 4.0+ | 1.0+ | 2.0+ | 7.0+ | 1.0+ | no |
Clones a node and returns the new node. | 5.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
| ||||||
Returns a string describing the component at the specified location. | 5.0+ | no | no | no | no | no |
Returns true if the HTMLElement contains the specified element. | 5.0+ | no | no | 8.0+ | no | no |
Detaches the specified function from the event handler so that the function is no longer called when the event fires. | 5.0+ | no | no | 8.0+ | no | no |
Redirects the specified event instance to be processed by the appropriate handler. | no | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
Fires a drag event on the element. | 5.5+ | no | no | no | no | no |
Fires an instance of the specified event. | 5.5+ | no | no | no | no | no |
Gives focus to the element. | 5.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
Gets the string of text in the position specified by where. | 5.0+ | no | no | no | no | no |
Gets the value of the specified attribute. | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
Gets the node of the specified attribute. | 6.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
Returns a TextRectangle that marks the top, bottom, left, and right boundaries (in pixels) of the content of the element. | 5.0+ | no | no | no | no | no |
Returns a collection of all of the TextRectangle objects contained by the element. | 5.0+ | no | no | no | no | no |
Returns an array of Element nodes with the specified tag name. | 5.0+ | 1.0+ | 6.0+ | 8.0+ | 1.0+ | no |
| ||||||
Returns the property expression specified by propertyName. | 5.0+ | no | no | no | no | no |
Determines if the given attribute exists on this element. | no | 1.0+ | 6.0+ | 7.0+ | 1.3+ | no |
Returns true if the node is an element node with attributes. | no | 1.0+ | 6.0+ | 7.0+ | 1.3+ | no |
Returns true if the node has child nodes. | 5.0+ | 1.0+ | 6.0+ | 8.0+ | 1.0+ | no |
Inserts the specified Element object adjacent to this element. | 5.0+ | no | no | no | no | no |
Inserts the specified string of HTML text adjacent to this element. Parsed as HTML. | 4.0+ | no | no | no | no | no |
Inserts the specified string of HTML text adjacent to this element. Not parsed as HTML. | 4.0+ | no | no | no | no | no |
Inserts a new child node in front of the reference child node. | 5.0+ | 1.0+ | 6.0+ | 8.0+ | 1.0+ | no |
Returns true if the specified feature and version are supported. | no | 1.0+ | 6.0+ | 8.0+ | 1.0+ | no |
Merges the attributes from the source element to the current element. | 5.0+ | no | no | no | no | no |
Merges text nodes adjacent to the element to create a normalized DOM. | N/A | 1.0+ | 6.0+ | 8.0+ | no | no |
| ||||||
Stops the mouse from capturing events on the element. | 5.0+ | no | no | no | no | no |
Removes an attribute by name | 6.0+ | 1.0+ | 6.0+ | 8.0+ | 1.0+ | no |
| ||||||
Removes the specified attribute node | 6.0+ | 1.0+ | 6.0+ | 8.0+ | 1.0+ | no |
| ||||||
Removes the specified attribute node | 5.0+ | no | no | no | no | no |
Removes the specified child node from the element and returns the node. | 5.0+ | 1.0+ | 6.0+ | 8.0+ | 1.0+ | no |
Removes an event listener from an event target. | no | 1.0+ | no | 7.0+ | 1.0+ | no |
Removes the specified property expression from the element. | 5.0+ | no | no | no | no | no |
Replaces the current text adjacent to the element with the specified text. | 5.0+ | no | no | no | no | no |
Removes the specified child node, replaces it with another node, and returns the removed node. | 5.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
Replaces the current node with the node specified in newNode. | 5.0+ | no | no | no | no | no |
Immediately scrolls the element into the viewable portion of the web page. | 4.0+ | 1.0+ | 7.0+ | no | no | no |
Sets this element as "active" without giving focus to the element. | 5.5+ | no | no | no | no | no |
Adds a new attribute. | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
| ||||||
Adds the given attribute node | 6.0+ | 1.0+ | 6.0+ | 8.0+ | 1.0+ | no |
| ||||||
Sets mouse capture to the element. | 5.0+ | no | no | no | no | no |
Sets the specified expression on the specified property of an element. | 5.0+ | no | no | no | no | no |
Swaps the current node with the specified node in the document. | 5.0+ | no | no | no | no | no |
Removes the watchpoint from the specified property. | no | no | 4.0+ | no | no | no |
Sets a watch point on a property. When the value of that property changes, the specified handler is automatically invoked. | no | no | 4.0+ | no | no | no |
References
HTMLAnchorElement | HTMLBodyElement | HTMLDocument | HTMLFormElement | HTMLInputElement | HTMLOptionElement | HTMLSelectElement | HTMLTableCaptionElement | HTMLTableCellElement | HTMLTableColElement | HTMLTableElement | HTMLTableRowElement | HTMLTableSectionElement | HTMLTextAreaElement
Availability
HTML DOM Level 2 | W3C
Constructor Detail
Property Detail
String accessKey
Character for the hotkey that gives focus to the element.
Array all - read only
Array of all of the elements in the element.
String align
Alignment property for the element. Used for display elements. (e.g. "center")
Array attributes - read only
Array of attributes for the element.
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 1
String begin
Gets or sets a time delay to lapse before the element starts "playing".
Array behaviorUrns - read only
Array of behaviors attached to the element.
Boolean canHaveChildren - read only
If true, indicates that the element can have child nodes.
Boolean canHaveHTML - read only
If true, indicates that the element can contain HTML tags.
Array childNodes - read only
Array of the child nodes of the element.
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 1
Array children - read only
Array of the child nodes of the element.
-
For examples, see the quirksmode test page:
String className
Name of the CSS class that the element belongs to.
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 2 | W3C
Number clientHeight - read only
Height of the content of the element (in pixels).
Number clientLeft - read only
Number of pixels between the offsetLeft property of the element and the start of the content of the element.
Number clientTop - read only
Number of pixels between the offsetTop property of the element and the top of the content of the element.
Number clientWidth - read only
Width of the content of the element (in pixels).
String contentEditable
Indicates whether the content of the element is editable. Possible values are "inherit", "true", or "false".
Object currentStyle - read only
Reference to the Style object specifying the styles applied to the element.
-
For examples, see the quirksmode test page:
String dir
Direction of the text in the element. Possible values are "ltr" (left-to-right) or "rtl" (right-to-left).
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 2 | W3C
Boolean disabled
If true, indicates that the element is disabled.
-
For examples, see the quirksmode test page:
Object document
Reference to the parent Document object for the element.
Array filters - read only
Array of Microsoft CSS filters on the element.
Object firstChild - read only
Reference to the first child element of the element, if one exists.
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 1
Boolean hasMedia
If true, indicates that the element is an HTML+TIME media element.
Boolean hideFocus
If true, the element does not give any visual cues to indicate when it has focus.
String id
Unique identifier for the element.
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 2 | W3C
String innerHTML
HTML content within the tags of the element.
-
For examples, see the quirksmode test page:
String innerText
Text string enclosed by the tags of the element. Any HTML tags will be interpreted as part of the text string, not as HTML.
-
For examples, see the quirksmode test page:
Boolean isContentEditable - read only
If true, indicates that the user can edit the contents of the element.
Boolean isDisabled - read only
If true, indicates that the element is disabled from user interaction.
Boolean isTextEdit - read only
If true, indicates that a TextRange object can be created using the element.
String lang
Language code for the content of the element.
- Availability
HTML DOM Level 2 | W3C
String language
Object lastChild
Reference to the last child element of the element, if it exists.
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 1
String localName - read only
Local XML name for the element.
String namespaceURI - read only
The XML Namespace URI for the element.
Object nextSibling - read only
Reference to the next sibling element of the element.
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 1
String nodeName - read only
Name of the element tag.
-
For examples, see the quirksmode test page:
- Remarks
- Returns an uppercase tag name.
- Availability
HTML DOM Level 1
Number nodeType - read only
Node type for the element. See Remarks for full explanation.
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 1
String nodeValue
Value of the element.
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 1
Number offsetHeight - read only
Height of the element (in pixels).
- See Also
Number offsetLeft - read only
Number of pixels the left edge of the element is offset from the left edge of its parent element.
- See Also
Object offsetParent - read only
Reference to the parent object corresponding with the offsetHeight, offsetWidth, offsetLeft, and offsetTop properties.
- See Also
Number offsetTop - read only
Number of pixels the top edge of the element is offset from the top edge of its parent element.
Number offsetWidth - read only
Width of the element (in pixels).
Function onactivate - read only
Fires when the element becomes active.
Function onbeforecopy - read only
Fires immediately before the selection is copied to the clipboard.
Function onbeforecut - read only
Fires immediately before the selection is cut to the clipboard.
Function onbeforedeactivate - read only
Fires immediately before the element stops being the active element.
Function onbeforeeditfocus - read only
Fires immediately before the element receives focus prior to being edited.
Function onbeforepaste - read only
Fires immediately before the selection is pasted from the clipboard to the element.
Function onblur - read only
Fires when the element loses focus.
Function onclick - read only
Fires when the element is clicked.
Function oncontextmenu - read only
Fires when the element is right-clicked and the context menu opens.
Function oncontrolselect - read only
Fires immediately before the element is selected.
Function oncopy - read only
Fires when the element is copied to the clipboard.
Function oncut - read only
Fires when the element is cut to the clipboard.
Function ondblclick - read only
Fires when the element is double-clicked.
Function ondeactivate - read only
Fires when the active element becomes inactive.
Function ondrag - read only
Fires when the element is dragged.
Function ondragend - read only
Fires when the element is released from being dragged.
Function ondragenter - read only
Fires when the element has another object dragged onto it that can be dropped on the element.
Function ondragleave - read only
Fires when an element has an object dragged out of it that could be dropped onto the element.
Function ondragover - read only
Fires when an element has an object dragged over it that could be dropped onto the element.
Function ondragstart - read only
Fires immediately before an element is dragged.
Function ondrop - read only
Fires when an object is dropped onto the element.
Function onfilterchange - read only
Fires when the CSS Filter of an element changes or finishes transitioning.
Function onfocus - read only
Fires when the element receives focus.
Function onhelp - read only
Fires when a user presses the F1 key to activate help.
Function onkeydown - read only
Fires when a user presses down on a key while the element has focus.
Function onkeypress - read only
Fires when a user presses a key or holds down the key while the element has focus.
Function onkeyup - read only
Fires when a user releases a key while the element has focus.
Function onlosecapture - read only
Fires when the element loses mouse capture.
Function onmousedown - read only
Fires when a user clicks down on the mouse button while the element has focus.
Function onmouseenter - read only
Fires when the mouse pointer enters the element.
- Remarks
- Differs from onmouseover in that onmouseenter does not bubble and is not cancelable.
Function onmouseleave - read only
Fires when the mouse pointer leaves the element.
- Remarks
- Differs from onmouseout in that onmouseleave does not bubble and is not cancelable.
Function onmousemove - read only
Fires when the mouse moves while the pointer over the element.
Function onmouseout - read only
Fires when the mouse pointer moves off of the element.
Function onmouseover - read only
Fires when the mouse pointer moves over the element.
Function onmouseup - read only
Fires when the user releases the mouse button while the element has focus.
Function onpaste - read only
Fires when the clipboard contents are pasted onto the element.
Function onpropertychange - read only
Fires when one of the properties of the element changes.
Function onreadystatechange - read only
Fires when the ready state of the element changes.
Function onresize - read only
Fires immediately before an element is about to be resized.
Function onresizeend - read only
Fires when the element is finished being resized.
Function onresizestart - read only
Fires immediately before a user resizes the element.
Function onselectstart - read only
Fires immediately before the element is selected.
String outerHTML
HTML mark-up for an element, including start and end tags and any content between the tags.
-
For examples, see the quirksmode test page:
- See Also
String outerText
Plain text for an element, including start and end tags.
-
For examples, see the quirksmode test page:
- See Also
Object ownerDocument - read only
Reference to the document that contains the element.
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 1
Object parentElement - read only
Reference to the direct parent element of the element.
Object parentNode - read only
Reference to the direct parent node of the element, if it exists.
-
For examples, see the quirksmode test page:
- See Also
- Availability
HTML DOM Level 1
Object parentTextEdit - read only
Reference to the closest parent element to the current element that can create a TextRange that contains the current element.
String prefix - read only
Prefix XML name for the element.
Object previousSibling - read only
Reference to the previous sibling element of the element, if it exists.
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 1
String readyState - read only
Current readiness state of the element. See Remarks for possible values.
- Remarks
- Valid values are 0 = uninitialized, 1 = open, 2 = sent, 3 = receiving, 4 = loaded.
Number recordNumber - read only
Record number for the data set that generated the element.
Number runtimeStyle - read only
Reference to the Style object specifying the current runtime style(s) of the element.
String scopeName - read only
XML scope of the element.
Number scrollHeight - read only
Height (in pixels) of the total content area of the element.
Number scrollLeft
Number of pixels between the actual left edge of the element to the displayed left edge of the element.
Number scrollTop
Number of pixels between the actual top edge of the element to the displayed top edge of the element.
Number scrollWidth - read only
Width (in pixels) of the total content area of the element.
Number sourceIndex - read only
Index of the element in the Document.all[] array.
-
For examples, see the quirksmode test page:
HTMLStyleObject style - read only
Reference to the inline CSS style for the element.
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 2
Boolean syncMaster - read only
If true, indicates that the time container of the element must synchronize playback with the element. Default is false.
Number tabIndex
Indicates the tab order index for the element.
String tagName
HTML tag name for the element.
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 1
String tagURN
URN for the XML Namespace of the element.
String timeContainer
Gets or sets the type of timeline that corresponds to the element.
String title
Value of the title attribute for the element.
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 2 | W3C
String uniqueID - read only
System-generated unique identifier for the element.
Method Detail
addBehavior(String url) : HTMLElement
Attaches a behavior to the element as specified in url.
| String | url | Reference to the behavior to attach. |
addEventListener(String whichEvent, Object handler, Boolean direction) : HTMLElement
Attaches an event listener to an HTMLElement that executes a function when the specified event occurs.
| String | whichEvent | Event to trigger the specified function. |
| Object | handler | Function to execute when the specified event occurs. |
| Boolean | direction | Specify true to fire the event during the capture phase. Specify false to fire the event during the bubbling phase. |
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 2
appendChild(Node newChild) : HTMLElement
Appends a child element to the end of the childNodes[] array for the element.
| Node | newChild | Node to add to the current element as a child. |
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 1
applyElement(String newElement, [String where]) : HTMLElement
Adds a new element to the current element either as a child or parent of the current element.
| String | newElement | Tag name of the element to add. |
| String | where | Specifies where to add the new element (i.e. either as a parent or child of the current element). Specify a value of "outside" (or omit) to add the new element as a parent to the current element. Otherwise the new element becomes the first child of the current element and any existing children of the current element then become direct children of the new element. (optional) |
-
For examples, see the quirksmode test page:
attachEvent(String whichHandler, String theFunction) : void
Attaches the specified event handler and function to the element so that every time the event fires, the function is called.
| String | whichHandler | Event handler to attach. |
| String | theFunction | Function to attach to the event handler. |
-
For examples, see the quirksmode test page:
blur() : void
Removes focus from the element.
- Availability
HTML DOM Level 1
clearAttributes() : void
Removes all attributes and values from the element.
-
For examples, see the quirksmode test page:
click() : void
Simulates a mouse click on the element. Fires the onclick event.
cloneNode(Boolean cloneChildren) : Node
Clones a node and returns the new node.
| Boolean | cloneChildren | If true, specifies that any child nodes of the node should also be cloned. |
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 1
componentFromPoint(Boolean x, Boolean y) : String
Returns a string describing the component at the specified location.
| Boolean | x | X-coordinate (in pixels). |
| Boolean | y | Y-coordinate (in pixels). |
contains(Boolean element) : Boolean
Returns true if the HTMLElement contains the specified element.
| Boolean | element | Element to check for. |
-
For examples, see the quirksmode test page:
detachEvent(Object whichHandler, Object theFunction) : void
Detaches the specified function from the event handler so that the function is no longer called when the event fires.
| Object | whichHandler | Event handler to detach. |
| Object | theFunction | Function to detach. |
-
For examples, see the quirksmode test page:
dispatchEvent(Boolean event) : void
Redirects the specified event instance to be processed by the appropriate handler.
| Boolean | event | Event to redirect. |
- Availability
HTML DOM Level 2
dragDrop() : void
Fires a drag event on the element.
fireEvent(Boolean handler, [Boolean event]) : void
Fires an instance of the specified event.
| Boolean | handler | Event handler for the event. |
| Boolean | event | Event to fire. (optional) |
focus() : void
Gives focus to the element.
- Availability
HTML DOM Level 2
getAdjacentText(String where) : String
Gets the string of text in the position specified by where.
| String | where | Specifies where to get the adjacent text from, relative to the element. Valid values are beforeBegin, afterBegin, beforeEnd, and afterEnd. |
getAttribute(String attributeName) : String
Gets the value of the specified attribute.
| String | attributeName | Name of the attribute. |
-
For more examples, see the quirksmode test page:
getAttributeNode(String attributeName) : Node
Gets the node of the specified attribute.
| String | attributeName | Name of the attribute. |
-
For more examples, see the quirksmode test page:
- Availability
HTML DOM Level 1
getBoundingClientRect() : Object
Returns a TextRectangle that marks the top, bottom, left, and right boundaries (in pixels) of the content of the element.
getClientRects() : Object
Returns a collection of all of the TextRectangle objects contained by the element.
getElementsByTagName(String tagname) : static Array
Returns an array of Element nodes with the specified tag name.
| String | tagname | Tag name of the elements to return. Specify "*" to return all tags. (one-or-more) |
-
Using getElementsByTagName
// Assume there is only one in the document var body = document.getElementsByTagName("body").item(0); var paragraphs = body.getElementsByTagName("p");For additional examples, see the quirksmode test page:
- Remarks
-
This method returns a list of elements in the document that have the specified
tagName. The returnedNodeListis sorted in the order the elements were found during a depth-firstpreorder traversalthrough the node tree. - See Also
Document.getElementById | Element.getElementsByTagName | HTMLDocument.getElementsByName
- Availability
HTML DOM Level 1
getExpression(String propertyName) : String
Returns the property expression specified by propertyName.
| String | propertyName | Name of the property/attribute. |
hasAttribute(String name) : Boolean
Determines if the given attribute exists on this element.
| String | name | Name of the attribute to check. |
-
Using hasAttribute
if (!element.hasAttribute("id")) { element.setAttribute("id", "newvalue"); }For more examples, see the quirksmode test page:
- Remarks
- Use this method to verify that an attribute exists on an Element before retrieving that attribute.
- See Also
Attr.specified | HTMLElement.getAttribute | HTMLElement.setAttribute
- Availability
HTML DOM Level 2
hasAttributes() : Boolean
Returns true if the node is an element node with attributes.
-
Using hasAttributes
var obj = document.Document.getElementById('EmailAddress'); if (obj.hasAttributes()) { window.alert("The node " + obj.Node.nodeName + " has attributes"); }For more examples, see the quirksmode test page:
- Remarks
- Returns true if this node is an
Elementand has any attributes. Returns false if there are none. Equivilant to checkingnode..attributes.NamedNodeMap.length > 0 - See Also
HTMLElement.getAttribute | HTMLElement.hasAttribute | Node.attributes
- Availability
HTML DOM Level 2
hasChildNodes() : Boolean
Returns true if the node has child nodes.
-
Using hasChildNodes
var obj = document.Document.getElementById('EmailAddress'); if (obj.hasChildNodes()) { window.alert("The node " + obj.Node.nodeName + " has children"); } - Remarks
- Returns true if this node has any child nodes. Returns false if there are none. Equivilant to checking
node..childNodes.NodeList.length> 0 - See Also
- Availability
HTML DOM Level 1
insertAdjacentElement(String where, Element element) : void
Inserts the specified Element object adjacent to this element.
| String | where | Specifies where to insert the element. Valid values are beforeBegin, afterBegin, beforeEnd, and afterEnd. |
| Element | element | Element to insert. |
insertAdjacentHTML(String where, String text) : void
Inserts the specified string of HTML text adjacent to this element. Parsed as HTML.
| String | where | Specifies where to insert the element. Valid values are beforeBegin, afterBegin, beforeEnd, and afterEnd. |
| String | text | HTML text to insert. |
insertAdjacentText(String where, String text) : void
Inserts the specified string of HTML text adjacent to this element. Not parsed as HTML.
| String | where | Specifies where to insert the element. Valid values are beforeBegin, afterBegin, beforeEnd, and afterEnd. |
| String | text | Text string to insert. |
- See Also
HTMLElement.insertAdjacentElement | HTMLElement.insertAdjacentHTML | HTMLElement.replaceAdjacentText
insertBefore(Node newChild, Node refChild) : void
Inserts a new child node in front of the reference child node.
| Node | newChild | New child node to insert. |
| Node | refChild | Reference child node. |
-
For examples, see the quirksmode test page:
- See Also
- Availability
HTML DOM Level 1
isSupported(String feature, [String version]) : Boolean
Returns true if the specified feature and version are supported.
| String | feature | Name of the feature. |
| String | version | Version of the feature. (optional) |
- Remarks
- Tests whether a node supports the specified feature. Similar to the
DOMImplementation.hasFeaturemethod and takes the same feature names. If version is null, returns true if any version of the feature is supported. - See Also
- Availability
HTML DOM Level 2
mergeAttributes(Object source, [Boolean preserve]) : void
Merges the attributes from the source element to the current element.
| Object | source | Source that supplies the attributes. |
| Boolean | preserve | If true, specifies that the id of the current element should be preserved. (optional) |
-
For examples, see the quirksmode test page:
normalize() : void
Merges text nodes adjacent to the element to create a normalized DOM.
-
For examples, see the quirksmode test page:
- Remarks
-
Normalizes any
Textnodes contained under this node and all of its children. Merges any adjacentTextnodes into one object, so that the nodes reflect how they would be structured if this XML document were freshly loaded.Normalize()is useful for manipulating the text content of nodes for editing. Instead of worrying about altering existingTextnodes, you can simply add new nodes and perform thenormalizewhen you finish your updates. - Availability
HTML DOM Level 1
releaseCapture() : void
Stops the mouse from capturing events on the element.
removeAttribute(String name) : void
Removes an attribute by name
| String | name | Name of the attribute to remove. |
-
Using removeAttribute
if (element.hasAttribute("id")) { element.removeAttribute("id"); }For more examples, see the quirksmode test page:
- Remarks
- Removes the specified attribute from the element. If the attribute has a defined default value, it will be set to that default value.
- Throws
- Raises a NO_MODIFICATION_ALLOWED_ERR error if the node is read-only.
- See Also
HTMLElement.getAttribute | HTMLElement.setAttribute | Node.attributes
- Availability
HTML DOM Level 1
removeAttributeNode(Attr oldAttr) : static Attr
Removes the specified attribute node
| Attr | oldAttr | Node to remove from the attribute. |
-
For examples, see the quirksmode test page:
- Remarks
- Removes an attribute from an element. If the attribute has a defined default value, the new attribute node value will immediately be set to that.
- Throws
- Raises a NO_MODIFICATION_ALLOWED_ERR error if the node is read-only. Raises a NOT_FOUND_ERR error if oldAttr object is not an attribute of this element.
- See Also
- Availability
HTML DOM Level 1
removeBehavior(String id) : static Boolean
Removes the specified attribute node
| String | id | id of the behavior to remove. |
- Remarks
- Removes the behavior specified by id from the element.
- See Also
removeChild(Node oldChild) : static Node
Removes the specified child node from the element and returns the node.
| Node | oldChild | Child node to remove. |
-
Using removeChild
var obj = document.Document.getElementById('EmailAddress'); try { var oldChild = obj.removeChild(obj.Node.firstChild); } catch DOMException { // Error handling };For more examples, see the quirksmode test page:
- Remarks
- Removes and returns the specified child node from the list of this node's children.
- Throws
- Raises a NO_MODIFICATION_ALLOWED_ERR if the node is read-only.
- Raises a NOT_FOUND_ERR if the supplied node is not a child of this one.
- See Also
- Availability
HTML DOM Level 1
removeEventListener(String type, EventListener listener, Boolean useCapture) : void
Removes an event listener from an event target.
| String | type | Type of event. |
| EventListener | listener | Event listener to be removed. |
| Boolean | useCapture | Specify "true" to remove a capturing event listener. Specify "false" to remove all other types of event listeners. |
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 2
removeExpression(String propertyName) : void
Removes the specified property expression from the element.
| String | propertyName | Name of the property expression to remove. |
replaceAdjacentText(String where, String text) : void
Replaces the current text adjacent to the element with the specified text.
| String | where | Specifies where to insert the element. Valid values are beforeBegin, afterBegin, beforeEnd, and afterEnd. |
| String | text | Text to replace the current text with. |
- See Also
replaceChild(Node newChild, Node oldChild) : static Node
Removes the specified child node, replaces it with another node, and returns the removed node.
| Node | newChild | Node to replace the oldChild node with. |
| Node | oldChild | Node to be replaced. |
-
Using replaceChild
var obj = document.Document.getElementById('EmailAddress'); var newElement = document.Document.createElement('label'); try { var oldChild = obj.replaceChild(newElement, obj.Node.lastChild); } catch DOMException { // Error handling };For more examples, see the quirksmode test page:
- Remarks
-
This method simplifies the process of calling
removeChildand theninsertBefore, so that you do not have to worry if this node is the first or last child.The new child node is removed if it already exists somewhere else in the DOM tree. If the new child is a
DocumentFragmentnode, theoldChildnode is replaced by all of the nodes within theDocumentFragment, in the same order. - Throws
- Raises a HIERARCHY_REQUEST_ERR error if either the node being inserted is one of this node's ancestors, or if the current node does not allow this type of node as a child.
- Raises a WRONG_DOCUMENT_ERR error if the newChild node was not created within the current document.
- Raises a NO_MODIFICATION_ALLOWED_ERR if this node is read-only or if the parent of the new node is read-only.
- Raises a NOT_FOUND_ERR if the supplied oldChild node is not a child of this one.
- See Also
HTMLElement.appendChild | HTMLElement.insertBefore | HTMLElement.removeChild
- Availability
HTML DOM Level 1
replaceNode(Node newNode) : void
Replaces the current node with the node specified in newNode.
| Node | newNode | Node to replace the current node with. |
-
For examples, see the quirksmode test page:
- See Also
scrollIntoView([Boolean alignToTop]) : void
Immediately scrolls the element into the viewable portion of the web page.
| Boolean | alignToTop | If true, specifies that the top of the element will be scrolled to align with the top of the window. Default is true. (optional) |
- Remarks
- Use the
scrollIntoViewmethod to visually direct users to a specific part of a web page, without forcing the users to scroll the page themselves. (e.g. Scrolling down to the "total" of a long shopping cart page.)
setActive() : void
Sets this element as "active" without giving focus to the element.
setAttribute(String name, String value) : void
Adds a new attribute.
| String | name | Name of the attribute to set. |
| String | value | String value of the attribute to set. |
-
Using setAttribute
var node = document.getElementById('address-list'); document.setAttribute('ref', 'urn:root'); document.setAttribute('datasources', 'http://mozref.com/reference/objects.rdf');For more examples, see the quirksmode test page:
- Remarks
- Sets either a new attribute value or updates an existing attribute value. This method can only set values as text strings, not HTML. Entities will not be parsed. To assign values containing entities to an attribute, use
setAttributeNode. - Throws
- Raises an INVALID_CHARACTER_ERR error if the supplied name contains an invalid character.
- Raises a NO_MODIFICATION_ALLOWED_ERR error if the node is read-only.
- See Also
HTMLElement.getAttribute | HTMLElement.removeAttribute | HTMLElement.setAttributeNode
- Availability
HTML DOM Level 1
setAttributeNode(Attr newAttr) : static Attr
Adds the given attribute node
| Attr | newAttr | Attr node of the attribute to set. |
-
Using setAttributeNode
var attr = node1.getAttributeNode("class"); node1.removeAttribute("class"); node2.setAttributeNode(attr);For more examples, see the quirksmode test page:
- Remarks
-
This method adds the specified
Attrobject as an attribute to the current element. You may specifiy actual DOM nodes instead of specifying separate arguments for the attribute name and value.If the element already has the attribute,
setAttributewill replace the node and return the old attribute node. Returns null, otherwise. - Throws
- Raises a WRONG_DOCUMENT_ERR error if the supplied newAttr was created from a different document.
- Raises a NO_MODIFICATION_ALLOWED_ERR error if the node is read-only.
- Raises an INUSE_ATTRIBUTE_ERR error if the supplied newAttr is already bound to another Element object.
- See Also
- Availability
HTML DOM Level 1
setCapture([Boolean containerCapture]) : void
Sets mouse capture to the element.
| Boolean | containerCapture | If true, specifies that events that originate in the container will be captured by the container. (optional) |
- Remarks
- Once set, routes all mouse events to this element.
setExpression(String property, String expression, [String language]) : void
Sets the specified expression on the specified property of an element.
| String | property | Name of the property to add the expression to. |
| String | expression | Expression to set. |
| String | language | Scripting language to use. Default is JScript. Other valid values are JavaScript and VBScript. (optional) |
- See Also
swapNode(Node node) : Node
Swaps the current node with the specified node in the document.
| Node | node | Node to swap this node with. |
-
For examples, see the quirksmode test page:
unwatch(String property) : void
Removes the watchpoint from the specified property.
| String | property | Property to remove the watch point from. |
watch(String property, String handler) : void
Sets a watch point on a property. When the value of that property changes, the specified handler is automatically invoked.
| String | property | Property to set the watch point on. |
| String | handler | Handler to invoke when the specified property changes. |
