HTML DOM HTMLElement Object

« Previous Chapter Next Reference »

HTMLElement Object

The collections, properties, methods, and events below can be used on all HTML elements.

HTMLElement Object Collections

W3C: W3C Standard.

Collection Description W3C
attributes[] Returns an array of the attributes of an element Yes
childNodes[] Returns an array of child nodes for an element Yes

HTMLElement Object Properties

Property Description W3C
accessKey Sets or returns an accesskey for an element Yes
className Sets or returns the class attribute of an element Yes
clientHeight Returns the viewable height of the content on a page (not including borders, margins, or scrollbars) Yes
clientWidth Returns the viewable width of the content on a page (not including borders, margins, or scrollbars) Yes
dir Sets or returns the text direction of an element Yes
disabled Sets or returns whether an element is disabled, or not Yes
firstChild Returns the first child of an element Yes
height Sets or returns the height attribute of an element Yes
id Sets or returns the id of an element Yes
innerHTML Sets or returns the HTML contents (+text) of an element Yes
lang Sets or returns the language code for an element Yes
lastChild Returns the last child of an element Yes
length   Yes
nextSibling Returns the element immediately following an element Yes
nodeName Returns the tagname of an element (in uppercase) Yes
nodeType Returns the type of the element Yes
nodeValue Returns the value of the element Yes
offsetHeight Returns the height of an element, including borders and padding if any, but not margins No
offsetLeft Returns the horizontal offset position of the current element relative to its offset container Yes
offsetParent Returns the offset container of an element Yes
offsetTop Returns the vertical offset position of the current element relative to its offset container Yes
offsetWidth Returns the width of an element, including borders and padding if any, but not margins No
ownerDocument Returns the root element (document object) for an element Yes
parentNode Returns the parent node of an element Yes
previousSibling Returns the element immediately before an element Yes
scrollHeight Returns the entire height of an element (including areas hidden with scrollbars) Yes
scrollLeft Returns the distance between the actual left edge of an element and its left edge currently in view Yes
scrollTop Returns the distance between the actual top edge of an element and its top edge currently in view Yes
scrollWidth Returns the entire width of an element (including areas hidden with scrollbars) Yes
style Sets or returns the style attribute of an element Yes
tabIndex Sets or returns the tab order of an element Yes
tagName Returns the tagname of an element as a string (in uppercase) Yes
title Sets or returns the title attribute of an element Yes
width Sets or returns the width attribute of an element Yes

HTMLElement Object Methods

Method Description W3C
appendChild() Adds a new child element to the end of the list of children of the element Yes
blur() Removes focus from an element Yes
click() Executes a click on an element Yes
cloneNode() Clones an element Yes
focus() Gives focus to an element Yes
getAttribute() Returns the value of an attribute Yes
getElementsByTagName() Accesses all elements with a specified tagname Yes
hasChildNodes() Returns whether an element has any child elements Yes
insertBefore() Inserts a new child element before an existing child element Yes
item() Returns an element based on its index within the document tree Yes
normalize() Puts all text nodes underneath this element (including attributes) into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes Yes
removeAttribute() Removes a specified attribute from an element Yes
removeChild() Removes a child element Yes
replaceChild() Replace a child element Yes
setAttribute() Adds a new attribute to an element Yes
toString() Converts an element to a string Yes

HTMLElement Object Events

Event Description W3C
onblur When an element loses focus Yes
onclick When a mouseclick on an element Yes
ondblclick When a mouse-doubleclick on an element Yes
onfocus When an element gets focus Yes
onkeydown When a keyboard key is pressed Yes
onkeypress When a keyboard key is pressed or held down Yes
onkeyup   Yes
onmousedown   Yes
onmousemove   Yes
onmouseout   Yes
onmouseover   Yes
onmouseup   Yes
onresize   Yes

« Previous Chapter Next Reference »

Have Any Suggestion? We Are Waiting To Hear from YOU!

Your Query was successfully sent!