H<n> object (Object/HTML)

An object that represents the <H1> to <H6> tags.

Availability:

DOM level - 1
JavaScript - 1.5
JScript - 3.0
Internet Explorer - 4.0
Netscape - 6.0
Inherits from:Element object
JavaScript syntax:IEmyH1 = myDocument.all.anElementID
IEmyH1 = myDocument.all.tags("H1")[anIndex]
IEmyH1 = myDocument.all[aName]
-myH1 = myDocument.getElementById(anElementID)
-myH1 = myDocument.getElementsByName(aName)[anIndex]
-myH1 = myDocument.getElementsByTagName("H1")[anIndex]
HTML syntax:<H1> ... </H1>, <H2> ... </H2>, <H3> ... </H3>, <H4> ... </H4>, <H5> ... </H5>, <H6> ... </H6>
Argument list:anIndexA reference to an element in a collection
aNameAn associative array reference
anElementIDThe ID value of an Element object
Object properties:align
Event handlers:onClick, onDblClick, onDragStart, onFilterChange, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onSelectStart

The properties, methods, collections and event handling support for the <H1> tag object are also provided for <H2> through <H6> tag objects as well. It is only necessary to document one of these object classes, although the other header types are each instantiated as objects of an appropriately named class in MSIE. The syntax examples illustrate the use of an <H1> tag object.

The <H1> through <H6> tags are block-level tags. That means that they force a line break before and after themselves.

The DOM level 1 specification refers to this and its sibling object types as a HeadingElement object.

See also:Element object

PropertyJavaScriptJScriptNIEOperaNESECMADOMCSSHTMLNotes
align1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a1 1 n/a n/a-

Event nameJavaScriptJScriptNIEOperaNESECMADOMCSSHTMLNotes
onClick1.5 1.53.0 3.06.0 6.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onDblClick1.5 1.53.0 3.06.0 6.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onDragStart n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onFilterChange n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onHelp n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/aWarning
onKeyDown1.5 1.53.0 3.06.0 6.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onKeyPress1.5 1.53.0 3.06.0 6.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onKeyUp1.5 1.53.0 3.06.0 6.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onMouseDown1.5 1.53.0 3.06.0 6.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onMouseMove1.5 1.53.0 3.06.0 6.04.0 4.0 n/a n/a n/a n/a n/a4.0 4.0Warning
onMouseOut1.5 1.53.0 3.06.0 6.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onMouseOver1.5 1.53.0 3.06.0 6.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onMouseUp1.5 1.53.0 3.06.0 6.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onSelectStart n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-

Inheritance chain:

Element object, Node object