09 January 2003
This section extends the DOM Level 2 Core API [DOM Level 2 Core] to describe objects and methods specific to HTML documents [HTML 4.01], and XHTML documents [XHTML 1.0]. In general, the functionality needed to manipulate hierarchical document structures, elements, and attributes will be found in the core section; functionality that depends on the specific elements defined in HTML will be found in this section.
The goals of the HTML-specific DOM API are:
The key differences between the core DOM and the HTML application of DOM is that the HTML Document Object Model exposes a number of convenience methods and properties that are consistent with the existing models and are more appropriate to script writers. In many cases, these enhancements are not applicable to a general DOM because they rely on the presence of a predefined DTD. The transitional or frameset DTD for HTML 4.01, or the XHTML 1.0 DTDs are assumed. Interoperability between implementations is only guaranteed for elements and attributes that are specified in the HTML 4.01 and XHTML 1.0 DTDs.
More specifically, this document includes the following specializations for HTML:
HTMLDocument
interface, derived from the core Document interface.
HTMLDocument
specifies the operations and queries that can be made on a HTML
document.HTMLElement
interface, derived from the core Element interface. HTMLElement specifies
the operations and queries that can be made on any HTML element.
Methods on HTMLElement include
those that allow for the retrieval and modification of attributes
that apply to all HTML elements.HTMLElement
interface. For all such attributes, the derived interface for the
element contains explicit methods for setting and getting the
values.The DOM Level 2 includes mechanisms to access and modify style specified through CSS and defines an event model that can be used with HTML documents.
The interfaces found within this section are not mandatory. A
DOM application may use the hasFeature(feature,
version) method of the DOMImplementation
interface with parameter values "HTML" and "2.0" (respectively) to
determine whether or not this module is supported by the
implementation. In addition to the feature string "HTML", the
feature string "XHTML" (version string "2.0") can be used to check
if the implementation supports XHTML (this is equivalent to
checking the features "XML" and "HTML"). In order to fully support
this module, an implementation must also support the "Core" feature
defined [DOM Level 2 Core]. Please refer
to additional information about
conformance in the DOM Level 2 Core specification [DOM Level 2
Core].
A DOM application can use the hasFeature method of
the DOMImplementation interface to determine whether
they are supported or not. The feature string for all the
interfaces listed in this section is "HTML" and the version is
"2.0". In order to fully support this feature, an implementation
needs also to support the "Core" feature defined in the Document
Object Model Level 2 Core [DOM Level 2 Core] (see also
Conformance).
The interfaces in this specification are designed for [HTML 4.01] documents, as well as for [XHTML 1.0] documents.
Note: This specification does not intend to define
exactly how a user agent will respond to a change to any attribute
on an element that directly or indirectly references external data,
such elements are HTMLAppletElement, HTMLFrameElement, HTMLFrameSetElement,
HTMLIFrameElement,
HTMLImageElement,
HTMLLinkElement,
HTMLObjectElement,
HTMLParamElement,
and HTMLScriptElement.
The HTML DOM follows a naming convention for properties, methods, events, collections, and data types. All names are defined as one or more English words concatenated together to form a single string.
The property or method name starts with the initial keyword in lowercase, and each subsequent word starts with a capital letter. For example, a property that returns document meta information such as the date the file was created might be named "fileDateCreated". In the ECMAScript binding, properties are exposed as properties of a given object. In Java, properties are exposed with get and set methods.
While most of the interfaces defined below can be mapped directly to elements defined in the HTML 4.01 Recommendation, some of them cannot. Similarly, not all attributes listed below have counterparts in the HTML 4.01 specification (and some do, but have been renamed to avoid conflicts with scripting languages). Interfaces and attribute definitions that have links to the HTML 4.0 specification have corresponding element and attribute definitions there; all others are added by this specification, either for convenience or backwards compatibility with DOM Level 0 implementations.
The DOM HTML Level 1 API [DOM Level 1] were originally intended to be used only for HTML 4.01 documents [HTML 4.01]. The APIs were defined well before XHTML 1.0 [XHTML 1.0] became a specification, or before it was worked on by the HTML Working Group.
From the DOM point of view, The biggest difference between HTML 4.01 (and earlier) and XHTML 1.0 is that XHTML is case sensitive, whereas HTML 4.01 is case insensitive. The HTML case insensitivity is also reflected in the DOM HTML API. For instance, element and attribute names are exposed as all uppercase (for consistency) when used on an HTML document, regardless of the character case used in the markup. Since XHTML is based on XML, in XHTML everything is case sensitive, and element and attribute names must be lowercase in the markup.
Developers need to take two things into account when writing
code that works on both HTML and XHTML documents. When comparing
element or attribute names to strings, the string compare needs to
be case insensitive, or the element or attribute name needs to be
converted into lowercase before comparing against a lowercase
string. Second, when calling methods that are case insensitive when
used on a HTML document (such as
getElementsByTagName() and namedItem()),
the string that is passed in should be lowercase.
Note: The interfaces provided in this document are only for [HTML 4.01] and [XHTML 1.0] documents and are not guaranteed to work with any future version of XHTML.
An HTMLCollection is a list of nodes. An individual
node may be accessed by either ordinal index or the node's
name or id attributes.
Note: Collections in the HTML DOM are assumed to be live meaning that they are automatically updated when the underlying document is changed.
interface HTMLCollection { readonly attribute unsigned long length; Node item(in unsigned long index); Node namedItem(in DOMString name); };
length of type unsigned
long, readonlyitem index of type
unsigned long0.|
|
The |
namedItem Node using
a name. With [HTML 4.01] documents, it first
searches for a Node with a matching id
attribute. If it doesn't find one, it then searches for a
Node with a matching name attribute, but
only on those elements that are allowed a name attribute. With [XHTML
1.0] documents, this method only searches for
Nodes with a matching id attribute. This
method is case insensitive in HTML documents and case sensitive in
XHTML documents.
name of type
DOMStringNode to be fetched.|
|
The |
An HTMLOptionsCollection is a list of nodes
representing HTML option element. An individual node may be
accessed by either ordinal index or the node's name or
id attributes.
Note: Collections in the HTML DOM are assumed to be live meaning that they are automatically updated when the underlying document is changed.
// Introduced in DOM Level 2: interface HTMLOptionsCollection { attribute unsigned long length; // raises(DOMException) on setting Node item(in unsigned long index); Node namedItem(in DOMString name); };
length of type
unsigned long|
|
NOT_SUPPORTED_ERR: if setting the length is not allowed by the implementation. |
item index of type
unsigned long|
|
The |
namedItem Node using
a name. It first searches for a Node with a matching
id attribute. If it doesn't find one, it then searches
for a Node with a matching name
attribute, but only on those elements that are allowed a name
attribute. This method is case insensitive in HTML documents and
case sensitive in XHTML documents.
name of type
DOMStringNode to be fetched.|
|
The |
An HTMLDocument is the root of the HTML hierarchy
and holds the entire content. Besides providing access to the
hierarchy, it also provides some convenience
methods for accessing certain sets of information from the
document.
The following properties have been deprecated in favor of the
corresponding ones for the BODY element:
Note: In DOM Level 2, the method
getElementById is inherited from the
Document interface where it was moved to.
interface HTMLDocument : Document { attribute DOMString title; readonly attribute DOMString referrer; readonly attribute DOMString domain; readonly attribute DOMString URL; attribute HTMLElement body; readonly attribute HTMLCollection images; readonly attribute HTMLCollection applets; readonly attribute HTMLCollection links; readonly attribute HTMLCollection forms; readonly attribute HTMLCollection anchors; attribute DOMString cookie; // raises(DOMException) on setting void open(); void close(); void write(in DOMString text); void writeln(in DOMString text); NodeList getElementsByName(in DOMString elementName); };
URL of type DOMString,
readonlyanchors of type HTMLCollection,
readonlyA) elements in a
document with a value for the name attribute.
Note: For reasons of backward compatibility, the returned
set of anchors only contains those anchors created with the
name attribute, not those created with the
id attribute. Note that in [XHTML
1.0], the name attribute (see section
4.10) has no semantics and is only present for legacy user
agents: the id attribute is used instead. Users should
prefer the iterator mechanisms provided by [DOM Level 2 Traversal]
instead.
applets of type HTMLCollection,
readonlyOBJECT elements that
include applets and APPLET (deprecated)
elements in a document.body of type HTMLElement BODY contents, returns the
BODY element. In frameset documents, this returns the
outermost FRAMESET element.cookie of type
DOMStringcookies non-terminal of [IETF RFC 2965], Section
4.2.2.cookie non-terminal of [IETF RFC
2965]; that is, it should be a single name-value pair followed
by zero or more cookie attribute values. If no domain attribute is
specified, then the domain attribute for the new value defaults to
the host portion of an absolute URI [IETF RFC 2396] of the current
frame or document. If no path attribute is specified, then the path
attribute for the new value defaults to the absolute path portion
of the URI [IETF RFC 2396] of the current
frame or document. If no max-age attribute is specified, then the
max-age attribute for the new value defaults to a user agent
defined value. If a cookie with the specified name is already
associated with the current frame or document, then the new value
as well as the new attributes replace the old value and attributes.
If a max-age attribute of 0 is specified for the new value, then
any existing cookies of the specified name are removed from the
cookie storage.
Note: See [IETF RFC 2965] for the semantics of persistent state item attribute value pairs.
Note: The precise nature of a user agent session is not defined by this specification.
|
|
SYNTAX_ERR: If the new value does not adhere to the cookie syntax specified by [IETF RFC 2965]. |
domain of type DOMString,
readonlynull if the server cannot be identified by a domain
name.forms of type HTMLCollection,
readonlyimages of type HTMLCollection,
readonlyIMG elements in a
document. The behavior is limited to IMG elements for
backwards compatibility.
Note: As suggested by [HTML 4.01], to include images,
authors may use the OBJECT element or the
IMG element. Therefore, it is recommended not to use
this attribute to find the images in the document but
getElementsByTagName with HTML 4.01 or
getElementsByTagNameNS with XHTML 1.0.
links of type HTMLCollection,
readonlyAREA elements and anchor
(A) elements in a document with a value for the
href attribute.referrer of type
DOMString, readonlytitle of type
DOMStringTITLE
element in the head of the document.close open() and forces rendering.
getElementsByName name value is given by elementName. In
[XHTML
1.0] documents, this methods only return the (possibly empty)
collection of form controls with matching name. This method is case
sensitive.
elementName of type
DOMStringname attribute value for an element.|
|
The matching elements. |
open Note: This method and the ones following allow a user to add to or replace the structure model of a document using strings of unparsed HTML. At the time of writing alternate methods for providing similar functionality for both HTML and XML documents were being considered (see [DOM Level 3 Load and Save]).
write open(). Note that the function will produce
a document which is not necessarily driven by a DTD and therefore
might be produce an invalid result in the context of the document.
text of type
DOMStringwriteln open(). Note
that the function will produce a document which is not necessarily
driven by a DTD and therefore might be produce an invalid result in
the context of the document
text of type
DOMStringHTML attributes are exposed as properties on the element object. The DOM naming conventions always determine the name of the exposed property, and are independent of the case of the attribute in the source document. The data type of the property is in general determined by the type of the attribute as determined by the HTML 4.01 (transitional and frameset) and XHTML 1.0 DTDs. The attributes have the semantics (including case-sensitivity) given in the [HTML 4.01] and [XHTML 1.0] specifications.
The attributes are exposed as properties for compatibility with
DOM Level 0.
This usage is deprecated because it can not be generalized to all
possible attribute names for XML. We recommend the use of generic
methods on the core Element interface for setting,
getting and removing attributes.
| DTD Data Type | Object Model Data Type |
|---|---|
| CDATA | DOMString |
| Value list (e.g., (left | right | center)) | DOMString |
| one-value Value list (e.g., (disabled)) | boolean |
| Number | long int |
In an HTML document the return value of an attribute that has a data type that is a value list is normalized to lowercase (independent of the case of the value in the source document).
For example, if the value of the align attribute on a P element
is "Left" (which is not a valid value in XHTML due to the case
sensitivity of XHTML) then the value is returned as "left". For
attributes with the CDATA data type, the case of the
return value is that given in the source document.
The return value of an attribute that is unspecified and does not have a default value is the empty string if the return type is a DOMString, false if the return type is a boolean and 0 if the return type is a number.
To avoid namespace conflicts, two attributes with the same name
as a keyword in one of our chosen binding languages
were prefixed. The for attribute of the
LABEL and SCRIPT elements collides with
loop construct naming conventions and is renamed
htmlFor. The class attribute of the HTML
elements collides with class definitions naming conventions and is
renamed className.
tagName, (nodeName))If the document is an HTML 4.01 document the element type names
exposed through a property are in uppercase. For example, the body
element type name is exposed through the tagName
property as BODY. If the document is an XHTML 1.0
document the element name is exposed as it is written in the XHTML
file. This means that the element type names are exposed in
lowercase for XHTML documents since the XHTML 1.0 DTDs defines
element type names as lowercase, and XHTML, being derived from XML,
is case sensitive.
All HTML element interfaces derive from this class. Elements
that only expose the HTML core attributes are represented by the
base HTMLElement interface. These elements are as
follows:
Note: The style attribute of an HTML element
is accessible through the ElementCSSInlineStyle
interface which is defined in the CSS module [DOM
Level 2 Style Sheets and CSS].
interface HTMLElement : Element { attribute DOMString id; attribute DOMString title; attribute DOMString lang; attribute DOMString dir; attribute DOMString className; };
className of type
DOMStringdir of type
DOMStringid of type
DOMStringlang of type
DOMStringtitle of type
DOMStringRoot of an HTML document. See the HTML element definition in HTML 4.01.
interface HTMLHtmlElement : HTMLElement { attribute DOMString version; };
version of type
DOMStringDocument head information. See the HEAD element definition in HTML 4.01.
interface HTMLHeadElement : HTMLElement { attribute DOMString profile; };
profile of type
DOMStringThe LINK element specifies a link to an external
resource, and defines this document's relationship to that resource
(or vice versa). See the
LINK element definition in HTML 4.01 (see also the
LinkStyle interface in the StyleSheet module [DOM
Level 2 Style Sheets and CSS]).
interface HTMLLinkElement : HTMLElement { attribute boolean disabled; attribute DOMString charset; attribute DOMString href; attribute DOMString hreflang; attribute DOMString media; attribute DOMString rel; attribute DOMString rev; attribute DOMString target; attribute DOMString type; };
charset of type
DOMStringdisabled of type
booleanhref of type
DOMStringhreflang of type
DOMStringmedia of type
DOMStringrel of type
DOMStringrev of type
DOMStringtarget of type
DOMStringtype of type
DOMStringThe document title. See the TITLE element definition in HTML 4.01.
interface HTMLTitleElement : HTMLElement { attribute DOMString text; };
text of type
DOMStringThis contains generic meta-information about the document. See the META element definition in HTML 4.01.
interface HTMLMetaElement : HTMLElement { attribute DOMString content; attribute DOMString httpEquiv; attribute DOMString name; attribute DOMString scheme; };
content of type
DOMStringhttpEquiv of type
DOMStringname of type
DOMStringscheme of type
DOMStringDocument base URI [IETF RFC 2396]. See the BASE element definition in HTML 4.01.
interface HTMLBaseElement : HTMLElement { attribute DOMString href; attribute DOMString target; };
href of type
DOMStringtarget of type
DOMStringThis element is used for single-line text input. See the ISINDEX element definition in HTML 4.01. This element is deprecated in HTML 4.01.
interface HTMLIsIndexElement : HTMLElement { readonly attribute HTMLFormElement form; attribute DOMString prompt; };
form of type HTMLFormElement,
readonlyFORM element containing this control.
Returns null if this control is not within the context
of a form.prompt of type
DOMStringStyle information. See the
STYLE element definition in HTML 4.01, the CSS module [DOM Level
2 Style Sheets and CSS] and the LinkStyle
interface in the StyleSheets module [DOM Level 2 Style Sheets and
CSS].
interface HTMLStyleElement : HTMLElement { attribute boolean disabled; attribute DOMString media; attribute DOMString type; };
disabled of type
booleanmedia of type
DOMStringtype of type
DOMStringThe HTML document body. This element is always present in the DOM API, even if the tags are not present in the source document. See the BODY element definition in HTML 4.01.
interface HTMLBodyElement : HTMLElement { attribute DOMString aLink; attribute DOMString background; attribute DOMString bgColor; attribute DOMString link; attribute DOMString text; attribute DOMString vLink; };
aLink of type
DOMStringbackground of type
DOMStringbgColor of type
DOMStringlink of type
DOMStringtext of type
DOMStringvLink of type
DOMStringThe FORM element encompasses behavior similar to a
collection and an element. It provides direct access to the
contained form controls as well as the attributes of the form
element. See the
FORM element definition in HTML 4.01.
interface HTMLFormElement : HTMLElement { readonly attribute HTMLCollection elements; readonly attribute long length; attribute DOMString name; attribute DOMString acceptCharset; attribute DOMString action; attribute DOMString enctype; attribute DOMString method; attribute DOMString target; void submit(); void reset(); };
acceptCharset of type
DOMStringaction of type
DOMStringelements of type HTMLCollection,
readonlyenctype of type
DOMStringNote: The onsubmit even handler is not guaranteed to be triggered when invoking this method. The behavior is inconsistent for historical reasons and authors should not rely on a particular one.
length of type
long, readonlymethod of type
DOMStringname of type
DOMStringtarget of type
DOMStringThe select element allows the selection of an option. The contained options can be directly accessed through the select element as a collection. See the SELECT element definition in HTML 4.01.
interface HTMLSelectElement : HTMLElement { readonly attribute DOMString type; attribute long selectedIndex; attribute DOMString value; // Modified in DOM Level 2: attribute unsigned long length; // raises(DOMException) on setting readonly attribute HTMLFormElement form; // Modified in DOM Level 2: readonly attribute HTMLOptionsCollection options; attribute boolean disabled; attribute boolean multiple; attribute DOMString name; attribute long size; attribute long tabIndex; void add(in HTMLElement element, in HTMLElement before) raises(DOMException); void remove(in long index); void blur(); void focus(); };
disabled of type
booleanform of type HTMLFormElement,
readonlyFORM element containing this control.
Returns null if this control is not within the context
of a form.length of type unsigned
long, modified in DOM Level 2SELECT.|
|
NOT_SUPPORTED_ERR: if setting the length is not allowed by the implementation. |
multiple of type
booleanOPTION elements may be selected
in this SELECT. See the
multiple attribute definition in HTML 4.01.name of type
DOMStringoptions of type HTMLOptionsCollection,
readonly, modified in DOM Level 2OPTION elements contained by
this element.selectedIndex of type
longsize of type longtabIndex of type
longtype of type DOMString,
readonlytrue
and the string "select-one" when false.value of type
DOMStringadd OPTION elements for this SELECT. This
method is the equivalent of the appendChild method of
the Node interface if the before
parameter is null. It is equivalent to the
insertBefore method on the parent of
before in all other cases. This method may have no
effect if the new element is not an OPTION or an
OPTGROUP.
element of type HTMLElement before of type HTMLElement null for the tail
of the list.|
|
NOT_FOUND_ERR: Raised if |
blur focus remove OPTION elements for this SELECT. Does
nothing if no element has the given index.
index of type
longGroup options together in logical subdivisions. See the OPTGROUP element definition in HTML 4.01.
interface HTMLOptGroupElement : HTMLElement { attribute boolean disabled; attribute DOMString label; };
disabled of type
booleanlabel of type
DOMStringA selectable choice. See the OPTION element definition in HTML 4.01.
interface HTMLOptionElement : HTMLElement { readonly attribute HTMLFormElement form; // Modified in DOM Level 2: attribute boolean defaultSelected; readonly attribute DOMString text; // Modified in DOM Level 2: readonly attribute long index; attribute boolean disabled; attribute DOMString label; attribute boolean selected; attribute DOMString value; };
defaultSelected of type
boolean, modified in DOM Level
2disabled of type
booleanform of type HTMLFormElement,
readonlyFORM element containing this control.
Returns null if this control is not within the context
of a form.index of type long,
readonly, modified in DOM Level 2OPTION in its parent
SELECT, starting from 0.label of type
DOMStringselected of type
booleantext of type DOMString,
readonlyvalue of type
DOMStringForm control.
Note: Depending upon the environment in which the page is being viewed, the value property may be read-only for the file upload input type. For the "password" input type, the actual value returned may be masked to prevent unauthorized use. See the INPUT element definition in [HTML 4.01].
interface HTMLInputElement : HTMLElement { attribute DOMString defaultValue; attribute boolean defaultChecked; readonly attribute HTMLFormElement form; attribute DOMString accept; attribute DOMString accessKey; attribute DOMString align; attribute DOMString alt; attribute boolean checked; attribute boolean disabled; attribute long maxLength; attribute DOMString name; attribute boolean readOnly; // Modified in DOM Level 2: attribute unsigned long size; attribute DOMString src; attribute long tabIndex; // Modified in DOM Level 2: attribute DOMString type; attribute DOMString useMap; attribute DOMString value; void blur(); void focus(); void select(); void click(); };
accept of type
DOMStringaccessKey of type
DOMStringalign of type
DOMStringalt of type
DOMStringchecked of type
booleantype attribute of the element has the
value "radio" or "checkbox", this represents the current state of
the form control, in an interactive user agent. Changes to this
attribute change the state of the form control, but do not change
the value of the HTML checked attribute of the INPUT element.
Note: During the handling of a click event on an input element with a type attribute that has the value "radio" or "checkbox", some implementations may change the value of this property before the event is being dispatched in the document. If the default action of the event is canceled, the value of the property may be changed back to its original value. This means that the value of this property during the handling of click events is implementation dependent.
defaultChecked of type
booleantype has the value "radio" or "checkbox",
this represents the HTML checked attribute of the element. The
value of this attribute does not change if the state of the
corresponding form control, in an interactive user agent, changes.
See the
checked attribute definition in HTML 4.01.defaultValue of type
DOMStringtype attribute of the element has the
value "text", "file" or "password", this represents the HTML value
attribute of the element. The value of this attribute does not
change if the contents of the corresponding form control, in an
interactive user agent, changes. See the
value attribute definition in HTML 4.01.disabled of type
booleanform of type HTMLFormElement,
readonlyFORM element containing this control.
Returns null if this control is not within the context
of a form.maxLength of type
longtype has the value "text" or "password". See the
maxlength attribute definition in HTML 4.01.name of type
DOMStringreadOnly of type
booleantype
has the value "text" or "password". See the
readonly attribute definition in HTML 4.01.size of type unsigned
long, modified in DOM Level 2src of type
DOMStringtype attribute has the value "image",
this attribute specifies the location of the image to be used to
decorate the graphical submit button. See the
src attribute definition in HTML 4.01.tabIndex of type
longtype of type DOMString,
modified in DOM Level 2useMap of type
DOMStringvalue of type
DOMStringtype attribute of the element has the
value "text", "file" or "password", this represents the current
contents of the corresponding form control, in an interactive user
agent. Changing this attribute changes the contents of the form
control, but does not change the value of the HTML value attribute
of the element. When the type attribute of the element
has the value "button", "hidden", "submit", "reset", "image",
"checkbox" or "radio", this represents the HTML value attribute of
the element. See the
value attribute definition in HTML 4.01.blur click INPUT
elements whose type attribute has one of the following
values: "button", "checkbox", "radio", "reset", or "submit".
focus select INPUT elements whose type attribute has
one of the following values: "text", "file", or "password".
Multi-line text field. See the TEXTAREA element definition in HTML 4.01.
interface HTMLTextAreaElement : HTMLElement { // Modified in DOM Level 2: attribute DOMString defaultValue; readonly attribute HTMLFormElement form; attribute DOMString accessKey; attribute long cols; attribute boolean disabled; attribute DOMString name; attribute boolean readOnly; attribute long rows; attribute long tabIndex; readonly attribute DOMString type; attribute DOMString value; void blur(); void focus(); void select(); };
accessKey of type
DOMStringcols of type longdefaultValue of type
DOMString, modified in DOM Level
2disabled of type
booleanform of type HTMLFormElement,
readonlyFORM element containing this control.
Returns null if this control is not within the context
of a form.name of type
DOMStringreadOnly of type
booleanrows of type longtabIndex of type
longtype of type
DOMString, readonlyvalue of type
DOMStringDOMString, the implementation may
truncate the data.Push button. See the BUTTON element definition in HTML 4.01.
interface HTMLButtonElement : HTMLElement { readonly attribute HTMLFormElement form; attribute DOMString accessKey; attribute boolean disabled; attribute DOMString name; attribute long tabIndex; readonly attribute DOMString type; attribute DOMString value; };
accessKey of type
DOMStringdisabled of type
booleanform of type HTMLFormElement,
readonlyFORM element containing this control.
Returns null if this control is not within the context
of a form.name of type
DOMStringtabIndex of type
longtype of type DOMString,
readonlyvalue of type
DOMStringForm field label text. See the LABEL element definition in HTML 4.01.
interface HTMLLabelElement : HTMLElement { readonly attribute HTMLFormElement form; attribute DOMString accessKey; attribute DOMString htmlFor; };
accessKey of type
DOMStringform of type HTMLFormElement,
readonlyFORM element containing this control.
Returns null if this control is not within the context
of a form.htmlFor of type
DOMStringid attribute. See the
for attribute definition in HTML 4.01.Organizes form controls into logical groups. See the FIELDSET element definition in HTML 4.01.
interface HTMLFieldSetElement : HTMLElement { readonly attribute HTMLFormElement form; };
form of type HTMLFormElement,
readonlyFORM element containing this control.
Returns null if this control is not within the context
of a form.Provides a caption for a FIELDSET grouping. See the
LEGEND element definition in HTML 4.01.
interface HTMLLegendElement : HTMLElement { readonly attribute HTMLFormElement form; attribute DOMString accessKey; attribute DOMString align; };
accessKey of type
DOMStringalign of type
DOMStringFIELDSET. See the
align attribute definition in HTML 4.01. This attribute is
deprecated in HTML 4.01.form of type HTMLFormElement,
readonlyFORM element containing this control.
Returns null if this control is not within the context
of a form.Unordered list. See the UL element definition in HTML 4.01.
interface HTMLUListElement : HTMLElement { attribute boolean compact; attribute DOMString type; };
compact of type
booleantype of type
DOMStringOrdered list. See the OL element definition in HTML 4.01.
interface HTMLOListElement : HTMLElement { attribute boolean compact; attribute long start; attribute DOMString type; };
compact of type
booleanstart of type longtype of type
DOMStringDefinition list. See the DL element definition in HTML 4.01.
interface HTMLDListElement : HTMLElement { attribute boolean compact; };
compact of type
booleanDirectory list. See the DIR element definition in HTML 4.01. This element is deprecated in HTML 4.01.
interface HTMLDirectoryElement : HTMLElement { attribute boolean compact; };
compact of type
booleanMenu list. See the MENU element definition in HTML 4.01. This element is deprecated in HTML 4.01.
interface HTMLMenuElement : HTMLElement { attribute boolean compact; };
compact of type
booleanList item. See the LI element definition in HTML 4.01.
interface HTMLLIElement : HTMLElement { attribute DOMString type; attribute long value; };
type of type
DOMStringvalue of type longOL. See the
value attribute definition in HTML 4.01. This attribute is
deprecated in HTML 4.01.Generic block container. See the DIV element definition in HTML 4.01.
interface HTMLDivElement : HTMLElement { attribute DOMString align; };
align of type
DOMStringParagraphs. See the P element definition in HTML 4.01.
interface HTMLParagraphElement : HTMLElement { attribute DOMString align; };
align of type
DOMStringFor the H1 to H6 elements. See the
H1 element definition in HTML 4.01.
interface HTMLHeadingElement : HTMLElement { attribute DOMString align; };
align of type
DOMStringFor the Q and BLOCKQUOTE elements. See
the
Q element definition in HTML 4.01.
interface HTMLQuoteElement : HTMLElement { attribute DOMString cite; };
cite of type
DOMStringPreformatted text. See the PRE element definition in HTML 4.01.
interface HTMLPreElement : HTMLElement { attribute long width; };
width of type longForce a line break. See the BR element definition in HTML 4.01.
interface HTMLBRElement : HTMLElement { attribute DOMString clear; };
clear of type
DOMStringBase font. See the BASEFONT element definition in HTML 4.01. This element is deprecated in HTML 4.01.
interface HTMLBaseFontElement : HTMLElement { attribute DOMString color; attribute DOMString face; // Modified in DOM Level 2: attribute long size; };
color of type
DOMStringface of type
DOMStringsize of type long,
modified in DOM Level 2Local change to font. See the FONT element definition in HTML 4.01. This element is deprecated in HTML 4.01.
interface HTMLFontElement : HTMLElement { attribute DOMString color; attribute DOMString face; attribute DOMString size; };
color of type
DOMStringface of type
DOMStringsize of type
DOMStringCreate a horizontal rule. See the HR element definition in HTML 4.01.
interface HTMLHRElement : HTMLElement { attribute DOMString align; attribute boolean noShade; attribute DOMString size; attribute DOMString width; };
align of type
DOMStringnoShade of type
booleansize of type
DOMStringwidth of type
DOMStringNotice of modification to part of a document. See the INS and DEL element definitions in HTML 4.01.
interface HTMLModElement : HTMLElement { attribute DOMString cite; attribute DOMString dateTime; };
cite of type
DOMStringdateTime of type
DOMStringThe anchor element. See the A element definition in HTML 4.01.
interface HTMLAnchorElement : HTMLElement { attribute DOMString accessKey; attribute DOMString charset; attribute DOMString coords; attribute DOMString href; attribute DOMString hreflang; attribute DOMString name; attribute DOMString rel; attribute DOMString rev; attribute DOMString shape; attribute long tabIndex; attribute DOMString target; attribute DOMString type; void blur(); void focus(); };
accessKey of type
DOMStringcharset of type
DOMStringcoords of type
DOMStringshape for the shape of the region.
See the
coords attribute definition in HTML 4.01.href of type
DOMStringhreflang of type
DOMStringname of type
DOMStringrel of type
DOMStringrev of type
DOMStringshape of type
DOMStringcoords. See the
shape attribute definition in HTML 4.01.tabIndex of type
longtarget of type
DOMStringtype of type
DOMStringEmbedded image. See the IMG element definition in HTML 4.01.
interface HTMLImageElement : HTMLElement { attribute DOMString name; attribute DOMString align; attribute DOMString alt; attribute DOMString border; // Modified in DOM Level 2: attribute long height; // Modified in DOM Level 2: attribute long hspace; attribute boolean isMap; attribute DOMString longDesc; attribute DOMString src; attribute DOMString useMap; // Modified in DOM Level 2: attribute long vspace; // Modified in DOM Level 2: attribute long width; };
align of type
DOMStringalt of type
DOMStringborder of type
DOMStringDOMString in DOM Level 1 HTML [DOM
Level 1].height of type long,
modified in DOM Level 2DOMString in DOM Level 1 HTML [DOM
Level 1].hspace of type long,
modified in DOM Level 2DOMString in DOM Level 1 HTML [DOM
Level 1].isMap of type
booleanlongDesc of type
DOMStringname of type
DOMStringsrc of type
DOMStringuseMap of type
DOMStringvspace of type long,
modified in DOM Level 2width of type long,
modified in DOM Level 2DOMString in DOM Level 1 HTML [DOM
Level 1].Generic embedded object.
Note: In principle, all properties on the object element are read-write but in some environments some properties may be read-only once the underlying object is instantiated. See the OBJECT element definition in [HTML 4.01].
interface HTMLObjectElement : HTMLElement { readonly attribute HTMLFormElement form; attribute DOMString code; attribute DOMString align; attribute DOMString archive; attribute DOMString border; attribute DOMString codeBase; attribute DOMString codeType; attribute DOMString data; attribute boolean declare; attribute DOMString height; attribute long hspace; attribute DOMString name; attribute DOMString standby; attribute long tabIndex; attribute DOMString type; attribute DOMString useMap; attribute long vspace; attribute DOMString width; // Introduced in DOM Level 2: readonly attribute Document contentDocument; };
align of type
DOMStringarchive of type
DOMStringborder of type
DOMStringcode of type
DOMStringcode attribute for
HTMLAppletElement.codeBase of type
DOMStringclassid, data, and archive
attributes. See the
codebase attribute definition in HTML 4.01.codeType of type
DOMStringclassid
attribute. See the
codetype attribute definition in HTML 4.01.contentDocument of type
Document, readonly, introduced in DOM Level 2null otherwise.data of type
DOMStringdeclare of type
booleanform of type HTMLFormElement,
readonlyFORM element containing this control.
Returns null if this control is not within the context
of a form.height of type
DOMStringhspace of type longname of type
DOMStringstandby of type
DOMStringtabIndex of type
longtype of type
DOMStringdata
attribute. See the
type attribute definition in HTML 4.01.useMap of type
DOMStringvspace of type longwidth of type
DOMStringParameters fed to the OBJECT element. See the
PARAM element definition in HTML 4.01.
interface HTMLParamElement : HTMLElement { attribute DOMString name; attribute DOMString type; attribute DOMString value; attribute DOMString valueType; };
name of type
DOMStringtype of type
DOMStringvalue attribute when
valuetype has the value "ref". See the
type attribute definition in HTML 4.01.value of type
DOMStringvalueType of type
DOMStringvalue
attribute value. See the
valuetype attribute definition in HTML 4.01.An embedded Java applet. See the APPLET element definition in HTML 4.01. This element is deprecated in HTML 4.01.
interface HTMLAppletElement : HTMLElement { attribute DOMString align; attribute DOMString alt; attribute DOMString archive; attribute DOMString code; attribute DOMString codeBase; attribute DOMString height; // Modified in DOM Level 2: attribute long hspace; attribute DOMString name; // Modified in DOM Level 2: attribute DOMString object; // Modified in DOM Level 2: attribute long vspace; attribute DOMString width; };
align of type
DOMStringalt of type
DOMStringarchive of type
DOMStringcode of type
DOMStringcodeBase of type
DOMStringheight of type
DOMStringhspace of type long,
modified in DOM Level 2name of type
DOMStringobject of type
DOMString, modified in DOM Level
2vspace of type long,
modified in DOM Level 2width of type
DOMStringClient-side image map. See the MAP element definition in HTML 4.01.
interface HTMLMapElement : HTMLElement { readonly attribute HTMLCollection areas; attribute DOMString name; };
areas of type HTMLCollection,
readonlyname of type
DOMStringusemap). See the
name attribute definition in HTML 4.01.Client-side image map area definition. See the AREA element definition in HTML 4.01.
interface HTMLAreaElement : HTMLElement { attribute DOMString accessKey; attribute DOMString alt; attribute DOMString coords; attribute DOMString href; attribute boolean noHref; attribute DOMString shape; attribute long tabIndex; attribute DOMString target; };
accessKey of type
DOMStringalt of type
DOMStringcoords of type
DOMStringshape for the shape of the region.
See the
coords attribute definition in HTML 4.01.href of type
DOMStringnoHref of type
booleanshape of type
DOMStringcoords. See the
shape attribute definition in HTML 4.01.tabIndex of type
longtarget of type
DOMStringScript statements. See the SCRIPT element definition in HTML 4.01.
interface HTMLScriptElement : HTMLElement { attribute DOMString text; attribute DOMString htmlFor; attribute DOMString event; attribute DOMString charset; attribute boolean defer; attribute DOMString src; attribute DOMString type; };
charset of type
DOMStringdefer of type
booleanevent of type
DOMStringhtmlFor of type
DOMStringsrc of type
DOMStringtext of type
DOMStringtype of type
DOMStringThe create* and delete* methods on the table allow authors to
construct and modify tables. [HTML 4.01] specifies that only
one of each of the CAPTION, THEAD, and
TFOOT elements may exist in a table. Therefore, if one
exists, and the createTHead() or createTFoot() method is called,
the method returns the existing THead or TFoot element. See the
TABLE element definition in HTML 4.01.
interface HTMLTableElement : HTMLElement { // Modified in DOM Level 2: attribute HTMLTableCaptionElement caption; // raises(DOMException) on setting // Modified in DOM Level 2: attribute HTMLTableSectionElement tHead; // raises(DOMException) on setting // Modified in DOM Level 2: attribute HTMLTableSectionElement tFoot; // raises(DOMException) on setting readonly attribute HTMLCollection rows; readonly attribute HTMLCollection tBodies; attribute DOMString align; attribute DOMString bgColor; attribute DOMString border; attribute DOMString cellPadding; attribute DOMString cellSpacing; attribute DOMString frame; attribute DOMString rules; attribute DOMString summary; attribute DOMString width; HTMLElement createTHead(); void deleteTHead(); HTMLElement createTFoot(); void deleteTFoot(); HTMLElement createCaption(); void deleteCaption(); // Modified in DOM Level 2: HTMLElement insertRow(in long index) raises(DOMException); // Modified in DOM Level 2: void deleteRow(in long index) raises(DOMException); };
align of type
DOMStringbgColor of type
DOMStringborder of type
DOMStringcaption of type HTMLTableCaptionElement,
modified in DOM Level 2CAPTION, or void if none
exists.|
|
HIERARCHY_REQUEST_ERR: if the element is not a
|
cellPadding of type
DOMStringcellSpacing of type
DOMStringframe of type
DOMStringrows of type HTMLCollection,
readonlyTHEAD, TFOOT, all
TBODY elements.rules of type
DOMStringsummary of type
DOMStringtBodies of type HTMLCollection,
readonlytFoot of type HTMLTableSectionElement,
modified in DOM Level 2TFOOT, or null if
none exists.|
|
HIERARCHY_REQUEST_ERR: if the element is not a
|
tHead of type HTMLTableSectionElement,
modified in DOM Level 2THEAD, or null if
none exists.|
|
HIERARCHY_REQUEST_ERR: if the element is not a
|
width of type
DOMStringcreateCaption |
A |
createTFoot |
A footer element ( |
createTHead |
A new table header element ( |
deleteCaption deleteRow modified in DOM Level 2index of type
long|
|
INDEX_SIZE_ERR: Raised if the specified index is greater than or equal to the number of rows or if the index is a negative number other than -1. |
deleteTFoot deleteTHead insertRow modified in DOM Level 2indexth row in the table. If
index is -1 or equal to the number of rows, the new
row is appended. In addition, when the table is empty the row is
inserted into a TBODY which is created and inserted
into the table.
Note: A table row cannot be empty according to [HTML 4.01].
index of type
long|
The newly created row. |
|
|
INDEX_SIZE_ERR: Raised if the specified index is greater than the number of rows or if the index is a negative number other than -1. |
Table caption See the CAPTION element definition in HTML 4.01.
interface HTMLTableCaptionElement : HTMLElement { attribute DOMString align; };
align of type
DOMStringRegroups the COL and COLGROUP
elements. See the
COL element definition in HTML 4.01.
interface HTMLTableColElement : HTMLElement { attribute DOMString align; attribute DOMString ch; attribute DOMString chOff; attribute long span; attribute DOMString vAlign; attribute DOMString width; };
align of type
DOMStringch of type DOMStringchOff of type
DOMStringspan of type longvAlign of type
DOMStringwidth of type
DOMStringThe THEAD, TFOOT, and
TBODY elements.
interface HTMLTableSectionElement : HTMLElement { attribute DOMString align; attribute DOMString ch; attribute DOMString chOff; attribute DOMString vAlign; readonly attribute HTMLCollection rows; // Modified in DOM Level 2: HTMLElement insertRow(in long index) raises(DOMException); // Modified in DOM Level 2: void deleteRow(in long index) raises(DOMException); };
align of type
DOMStringalign attribute for HTMLTheadElement for
details.ch of type
DOMStringchOff of type
DOMStringrows of type HTMLCollection,
readonlyvAlign of type
DOMStringvalign attribute for HTMLTheadElement for
details.deleteRow modified in DOM Level 2index of type
long|
|
INDEX_SIZE_ERR: Raised if the specified index is greater than or equal to the number of rows or if the index is a negative number other than -1. |
insertRow modified in DOM Level 2indexth row in
this section. If index is -1 or equal to the number of
rows in this section, the new row is appended.
index of type
long|
The newly created row. |
|
|
INDEX_SIZE_ERR: Raised if the specified index is greater than the number of rows of if the index is a negative number other than -1. |
A row in a table. See the TR element definition in HTML 4.01.
interface HTMLTableRowElement : HTMLElement { // Modified in DOM Level 2: readonly attribute long rowIndex; // Modified in DOM Level 2: readonly attribute long sectionRowIndex; // Modified in DOM Level 2: readonly attribute HTMLCollection cells; attribute DOMString align; attribute DOMString bgColor; attribute DOMString ch; attribute DOMString chOff; attribute DOMString vAlign; // Modified in DOM Level 2: HTMLElement insertCell(in long index) raises(DOMException); // Modified in DOM Level 2: void deleteCell(in long index) raises(DOMException); };
align of type
DOMStringbgColor of type
DOMStringcells of type HTMLCollection,
readonly, modified in DOM Level 2ch of type
DOMStringchOff of type
DOMStringrowIndex of type long,
readonly, modified in DOM Level 2rowIndex does take into account sections
(THEAD, TFOOT, or TBODY)
within the table, placing THEAD rows first in the
index, followed by TBODY rows, followed by
TFOOT rows.sectionRowIndex of type
long, readonly, modified in DOM
Level 2THEAD, TFOOT, or TBODY),
starting from 0.vAlign of type
DOMStringdeleteCell modified in DOM Level 2index of type
long|
|
INDEX_SIZE_ERR: Raised if the specified |
insertCell modified in DOM Level 2TD cell into this
row. If index is -1 or equal to the number of cells,
the new cell is appended.
index of type
long|
The newly created cell. |
|
|
INDEX_SIZE_ERR: Raised if the specified |
The object used to represent the TH and
TD elements. See the
TD element definition in HTML 4.01.
interface HTMLTableCellElement : HTMLElement { readonly attribute long cellIndex; attribute DOMString abbr; attribute DOMString align; attribute DOMString axis; attribute DOMString bgColor; attribute DOMString ch; attribute DOMString chOff; attribute long colSpan; attribute DOMString headers; attribute DOMString height; attribute boolean noWrap; attribute long rowSpan; attribute DOMString scope; attribute DOMString vAlign; attribute DOMString width; };
abbr of type
DOMStringalign of type
DOMStringaxis of type
DOMStringbgColor of type
DOMStringcellIndex of type long,
readonlych of type
DOMStringchOff of type
DOMStringcolSpan of type
longheaders of type
DOMStringid attribute values for header cells. See
the
headers attribute definition in HTML 4.01.height of type
DOMStringnoWrap of type
booleanrowSpan of type
longscope of type
DOMStringvAlign of type
DOMStringwidth of type
DOMStringCreate a grid of frames. See the FRAMESET element definition in HTML 4.01.
interface HTMLFrameSetElement : HTMLElement { attribute DOMString cols; attribute DOMString rows; };
cols of type
DOMStringrows of type
DOMStringCreate a frame. See the FRAME element definition in HTML 4.01.
interface HTMLFrameElement : HTMLElement { attribute DOMString frameBorder; attribute DOMString longDesc; attribute DOMString marginHeight; attribute DOMString marginWidth; attribute DOMString name; attribute boolean noResize; attribute DOMString scrolling; attribute DOMString src; // Introduced in DOM Level 2: readonly attribute Document contentDocument; };
contentDocument of type
Document, readonly, introduced in DOM Level 2null otherwise.frameBorder of type
DOMStringlongDesc of type
DOMStringmarginHeight of type
DOMStringmarginWidth of type
DOMStringname of type
DOMStringtarget attribute).
See the
name attribute definition in HTML 4.01.noResize of type
booleanscrolling of type
DOMStringsrc of type
DOMStringInline subwindows. See the IFRAME element definition in HTML 4.01.
interface HTMLIFrameElement : HTMLElement { attribute DOMString align; attribute DOMString frameBorder; attribute DOMString height; attribute DOMString longDesc; attribute DOMString marginHeight; attribute DOMString marginWidth; attribute DOMString name; attribute DOMString scrolling; attribute DOMString src; attribute DOMString width; // Introduced in DOM Level 2: readonly attribute Document contentDocument; };
align of type
DOMStringcontentDocument of type
Document, readonly, introduced in DOM Level 2null otherwise.frameBorder of type
DOMStringheight of type
DOMStringlongDesc of type
DOMStringmarginHeight of type
DOMStringmarginWidth of type
DOMStringname of type
DOMStringtarget attribute).
See the
name attribute definition in HTML 4.01.scrolling of type
DOMStringsrc of type
DOMStringwidth of type
DOMString