HTMLElement : Element
Return to: HTML DOM Level 2 index

HTMLElement is the parent class of all HTML elements.

Platform Support

IE Mozilla Netscape Opera Safari
3.0+ 1.0+ 2.0+ 7.0+ 1.0+

Constructors

Constructor Action IE Mozilla Netscape Opera Safari
HTMLElement Constructor() : HTMLElement
HTMLElement is the parent class of all HTML elements.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

HTMLElement() : HTMLElement

HTMLElement is the parent class of all HTML elements.

Returns
HTMLElement

Visibility
internal

Properties

Property Action IE Mozilla Netscape Opera Safari
accessKey : String
Character for the hotkey that gives focus to the element.
No Details 4.0+ no no no no
all : Array
Array of all of the elements in the element.
No Details 4.0+ no no no no
align : String
Alignment property for the element. Used for display elements. (e.g. "center")
No Details 4.0+ no no no no
attributes : Array
Array of attributes for the element.
Show Details 5.0+ 1.0+ 6.0+ 7.0+ 1.0+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/attributes.html

Availability

HTML DOM Level 1

begin : String
Gets or sets a time delay to lapse before the element starts "playing".
No Details 5.5+ no no no no
behaviorUrns : Array
Array of behaviors attached to the element.
No Details 5.0+ no no no no
canHaveChildren : Boolean
If true, indicates that the element can have child nodes.
No Details 5.0+ no no no no
canHaveHTML : Boolean
If true, indicates that the element can contain HTML tags.
No Details 5.5+ no no no no
childNodes : Array
Array of the child nodes of the element.
Show Details 5.0+ 1.0+ 6.0+ 7.0+ 1.0+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/children.html

Availability

HTML DOM Level 1

children : Array
Array of the child nodes of the element.
Show Details 4.0+ no no 8.0+ 1.3+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/children.html

className : String
Name of the CSS class that the element belongs to.
Show Details 4.0+ 1.0+ 6.0+ 7.0+ 1.0+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/taginfo.html

Availability

HTML DOM Level 2|W3C

clientHeight : Number
Height of the content of the element (in pixels).
No Details 4.0+ 1.0+ 7.0+ 7.0+ 1.0+
clientLeft : Number
Number of pixels between the offsetLeft property of the element and the start of the content of the element.
No Details 4.0+ no no no no
clientTop : Number
Number of pixels between the offsetTop property of the element and the top of the content of the element.
No Details 4.0+ no no no no
clientWidth : Number
Width of the content of the element (in pixels).
No Details 4.0+ 1.0+ 7.0+ 7.0+ 1.0+
contentEditable : String
Indicates whether the content of the element is editable. Possible values are "inherit", "true", or "false".
No Details 5.5+ no no no no
currentStyle : Object
Reference to the Style object specifying the styles applied to the element.
Show Details 5.0+ no no no no

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/style.html

dir : String
Direction of the text in the element. Possible values are "ltr" (left-to-right) or "rtl" (right-to-left).
Show Details 5.0+ 1.0+ 6.0+ 7.0+ 1.0+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/taginfo.html

Availability

HTML DOM Level 2|W3C

disabled : Boolean
If true, indicates that the element is disabled.
Show Details 4.0+ 1.0+ 6.0+ 7.0+ 1.0+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/stylesheets.html

document : Object
Reference to the parent Document object for the element.
No Details 4.0+ no no no no
filters : Array
Array of Microsoft CSS filters on the element.
No Details 5.5+ no no no no
firstChild : Object
Reference to the first child element of the element, if one exists.
Show Details 5.0+ 1.0+ 6.0+ 7.0+ 1.0+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/nodetree.html

Availability

HTML DOM Level 1

hasMedia : Boolean
If true, indicates that the element is an HTML+TIME media element.
No Details 5.5+ no no no no
hideFocus : Boolean
If true, the element does not give any visual cues to indicate when it has focus.
No Details 5.5+ no no no no
id : String
Unique identifier for the element.
Show Details 4.0+ 1.0+ 6.0+ 7.0+ 1.0+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/taginfo.html

Availability

HTML DOM Level 2|W3C

innerHTML : String
HTML content within the tags of the element.
Show Details 4.0+ 1.0+ 6.0+ 7.0+ 1.0+
  • IE: Buggy on Mac.

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/innerhtml.html

innerText : String
Text string enclosed by the tags of the element. Any HTML tags will be interpreted as part of the text string, not as HTML.
Show Details 4.0+ no 6.0+ 7.0+ 1.0+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/innerhtml.html

isContentEditable : Boolean
If true, indicates that the user can edit the contents of the element.
No Details 5.5+ no no no no
isDisabled : Boolean
If true, indicates that the element is disabled from user interaction.
No Details 5.5+ no no no no
isTextEdit : Boolean
If true, indicates that a TextRange object can be created using the element.
No Details 4.0+ no no no no
lang : String
Language code for the content of the element.
Show Details 4.0+ 1.0+ 6.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

language : String
No Details 4.0+ no no no no
lastChild : Object
Reference to the last child element of the element, if it exists.
Show Details 5.0+ 1.0+ 6.0+ 7.0+ 1.0+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/nodetree.html

Availability

HTML DOM Level 1

localName : String
Local XML name for the element.
No Details no 1.0+ 6.0+ 7.0+ 1.0+
namespaceURI : String
The XML Namespace URI for the element.
No Details no 1.0+ 6.0+ 7.0+ 1.0+
nextSibling : Object
Reference to the next sibling element of the element.
Show Details 5.0+ 1.0+ 6.0+ 7.0+ 1.0+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/nodetree.html

Availability

HTML DOM Level 1

nodeName : String
Name of the element tag.
Show Details 5.0+ 1.0+ 6.0+ 8.0+ 1.3+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/aboutnodes.html

Remarks
Returns an uppercase tag name.
Availability

HTML DOM Level 1

nodeType : Number
Node type for the element. See Remarks for full explanation.
Show Details 5.5+ 1.0+ 6.0+ 8.0+ 1.3+
  • IE: IE 5.0 on Windows does not assign nodeType attributes. Fixed in IE 5.5.

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/aboutnodes.html

Availability

HTML DOM Level 1

nodeValue : String
Value of the element.
Show Details 5.0+ 1.0+ 6.0+ 8.0+ 1.3+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/aboutnodes.html

Availability

HTML DOM Level 1

offsetHeight : Number
Height of the element (in pixels).
Show Details 4.0+ 1.0+ 6.0+ 7.0+ 1.0+
See Also

offsetLeft|offsetParent|offsetTop|offsetWidth

offsetLeft : Number
Number of pixels the left edge of the element is offset from the left edge of its parent element.
Show Details 4.0+ 1.0+ 6.0+ 7.0+ 1.0+
See Also

offsetHeight|offsetParent|offsetTop|offsetWidth

offsetParent : Object
Reference to the parent object corresponding with the offsetHeight, offsetWidth, offsetLeft, and offsetTop properties.
Show Details 4.0+ 1.0+ 6.0+ 7.0+ 1.0+
See Also

offsetHeight|offsetLeft|offsetTop|offsetWidth

offsetTop : Number
Number of pixels the top edge of the element is offset from the top edge of its parent element.
No Details 4.0+ 1.0+ 6.0+ 7.0+ 1.0+
offsetWidth : Number
Width of the element (in pixels).
No Details 4.0+ 1.0+ 6.0+ 7.0+ 1.0+
onactivate : Function
Fires when the element becomes active.
No Details 4.0+ no no no no
onbeforecopy : Function
Fires immediately before the selection is copied to the clipboard.
No Details 4.0+ no no no 1.0+
onbeforecut : Function
Fires immediately before the selection is cut to the clipboard.
No Details 4.0+ no no no 1.0+
onbeforedeactivate : Function
Fires immediately before the element stops being the active element.
No Details 4.0+ no no no no
onbeforeeditfocus : Function
Fires immediately before the element receives focus prior to being edited.
No Details 4.0+ no no no no
onbeforepaste : Function
Fires immediately before the selection is pasted from the clipboard to the element.
No Details 4.0+ no no no 1.0+
onblur : Function
Fires when the element loses focus.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
onclick : Function
Fires when the element is clicked.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
oncontextmenu : Function
Fires when the element is right-clicked and the context menu opens.
No Details 4.0+ no no no 1.0+
oncontrolselect : Function
Fires immediately before the element is selected.
No Details 4.0+ no no no no
oncopy : Function
Fires when the element is copied to the clipboard.
No Details 4.0+ no no no 1.0+
oncut : Function
Fires when the element is cut to the clipboard.
No Details 4.0+ no no no 1.0+
ondblclick : Function
Fires when the element is double-clicked.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
ondeactivate : Function
Fires when the active element becomes inactive.
No Details 4.0+ no no no no
ondrag : Function
Fires when the element is dragged.
No Details 4.0+ no no no 1.0+
ondragend : Function
Fires when the element is released from being dragged.
No Details 4.0+ no no no 1.0+
ondragenter : Function
Fires when the element has another object dragged onto it that can be dropped on the element.
No Details 4.0+ no no no 1.0+
ondragleave : Function
Fires when an element has an object dragged out of it that could be dropped onto the element.
No Details 4.0+ no no no 1.0+
ondragover : Function
Fires when an element has an object dragged over it that could be dropped onto the element.
No Details 4.0+ no no no 1.0+
ondragstart : Function
Fires immediately before an element is dragged.
No Details 4.0+ no no no 1.0+
ondrop : Function
Fires when an object is dropped onto the element.
No Details 4.0+ no no no 1.0+
onfilterchange : Function
Fires when the CSS Filter of an element changes or finishes transitioning.
No Details 4.0+ no no no no
onfocus : Function
Fires when the element receives focus.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
onhelp : Function
Fires when a user presses the F1 key to activate help.
No Details 4.0+ no no no no
onkeydown : Function
Fires when a user presses down on a key while the element has focus.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
onkeypress : Function
Fires when a user presses a key or holds down the key while the element has focus.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
onkeyup : Function
Fires when a user releases a key while the element has focus.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
onlosecapture : Function
Fires when the element loses mouse capture.
No Details 4.0+ no no no no
onmousedown : Function
Fires when a user clicks down on the mouse button while the element has focus.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
onmouseenter : Function
Fires when the mouse pointer enters the element.
Show Details 4.0+ no no no no
Remarks
Differs from onmouseover in that onmouseenter does not bubble and is not cancelable.
onmouseleave : Function
Fires when the mouse pointer leaves the element.
Show Details 4.0+ no no no no
Remarks
Differs from onmouseout in that onmouseleave does not bubble and is not cancelable.
onmousemove : Function
Fires when the mouse moves while the pointer over the element.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
onmouseout : Function
Fires when the mouse pointer moves off of the element.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
onmouseover : Function
Fires when the mouse pointer moves over the element.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
onmouseup : Function
Fires when the user releases the mouse button while the element has focus.
No Details 2.0+ 1.0+ 1.0+ 4.0+ 1.0+
onpaste : Function
Fires when the clipboard contents are pasted onto the element.
No Details 4.0+ no no no 1.0+
onpropertychange : Function
Fires when one of the properties of the element changes.
No Details 4.0+ no no no no
onreadystatechange : Function
Fires when the ready state of the element changes.
No Details 4.0+ no no no no
onresize : Function
Fires immediately before an element is about to be resized.
No Details 4.0+ no no no 1.0+
onresizeend : Function
Fires when the element is finished being resized.
No Details 4.0+ no no no no
onresizestart : Function
Fires immediately before a user resizes the element.
No Details 4.0+ no no no no
onselectstart : Function
Fires immediately before the element is selected.
No Details 4.0+ no no no 1.0+
outerHTML : String
HTML mark-up for an element, including start and end tags and any content between the tags.
Show Details 4.0+ no no 8.0+ 1.3+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/innerhtml.html

See Also

innerHTML|outerText

outerText : String
Plain text for an element, including start and end tags.
Show Details 4.0+ no no 8.0+ 1.3+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/innerhtml.html

See Also

outerHTML|innerText

ownerDocument : Object
Reference to the document that contains the element.
Show Details 6.0+ 1.0+ 6.0+ 7.0+ 1.0+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/document.html

Availability

HTML DOM Level 1

parentElement : Object
Reference to the direct parent element of the element.
No Details 4.0+ no no no no
parentNode : Object
Reference to the direct parent node of the element, if it exists.
Show Details 4.0+ 1.0+ 6.0+ 4.0+ 1.0+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/nodetree.html

See Also

parentElement

Availability

HTML DOM Level 1

parentTextEdit : Object
Reference to the closest parent element to the current element that can create a TextRange that contains the current element.
No Details 4.0+ no no no no
prefix : String
Prefix XML name for the element.
No Details no 1.0+ no 4.0+ 1.0+
Reference to the previous sibling element of the element, if it exists.
Show Details 5.0+ 1.0+ 6.0+ 4.0+ 1.0+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/nodetree.html

Availability

HTML DOM Level 1

readyState : String
Current readiness state of the element. See Remarks for possible values.
Show Details 4.0+ no no no no
Remarks
Valid values are 0 = uninitialized, 1 = open, 2 = sent, 3 = receiving, 4 = loaded.
recordNumber : Number
Record number for the data set that generated the element.
No Details 4.0+ no no no no
runtimeStyle : Number
Reference to the Style object specifying the current runtime style(s) of the element.
No Details 5.0+ no no no no
scopeName : String
XML scope of the element.
No Details 5.0+ no no no no
scrollHeight : Number
Height (in pixels) of the total content area of the element.
No Details 4.0+ 1.0+ 7.0+ 7.0+ 1.0+
scrollLeft : Number
Number of pixels between the actual left edge of the element to the displayed left edge of the element.
No Details 4.0+ 1.0+ 7.0+ 7.0+ 1.0+
scrollTop : Number
Number of pixels between the actual top edge of the element to the displayed top edge of the element.
No Details 4.0+ 1.0+ 7.0+ 7.0+ 1.0+
scrollWidth : Number
Width (in pixels) of the total content area of the element.
No Details 4.0+ 1.0+ 7.0+ 7.0+ 1.0+
sourceIndex : Number
Index of the element in the Document.all[] array.
Show Details 4.0+ no no 8.0+ no

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/nodetree.html

style : HTMLStyleObject
Reference to the inline CSS style for the element.
Show Details 4.0+ 1.0+ 6.0+ 7.0+ 1.0+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/style.html

Availability

HTML DOM Level 2

syncMaster : Boolean
If true, indicates that the time container of the element must synchronize playback with the element. Default is false.
No Details 5.5+ no no no no
tabIndex : Number
Indicates the tab order index for the element.
No Details 4.0+ 1.0+ 6.0+ 7.0+ 1.0+