This section extends the Core API to describe objects and methods specific to HTML documents. 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 and frameset DTDs for HTML 4.0 are assumed. Interoperability between implementations is only guaranteed for elements and attributes that are specified in the HTML 4.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 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".
The interfaces in this specification are designed for HTML 4.0 documents, and not for XHTML 1.0 documents. Use of the HTML DOM with XHTML 1.0 documents may result in incorrect processing; see Appendix C11 in [XHTML10] for more information.
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.0 Recommendation, some of them cannot. Similarly, not all attributes listed below have counterparts in the HTML 4.0 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 HTMLDOMImplementation
interface extends the
DOMImplementation
interface with a method for creating an
HTML document instance.
// Introduced in DOM Level 2: interface HTMLDOMImplementation : DOMImplementation { HTMLDocument createHTMLDocument(in DOMString title); };
createHTMLDocument
HTMLDocument
object with the minimal tree
made of the following elements: HTML
, HEAD
,
TITLE
, and BODY
.
A new |
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
, readonly
An HTMLDocument
is the root of the HTML
hierarchy and holds the entire content. Beside 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.
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; void open(); void close(); void write(in DOMString text); void writeln(in DOMString text); NodeList getElementsByName(in DOMString elementName); };
title
of type DOMString
TITLE
element in the head of the document.
referrer
of type DOMString
, readonly
domain
of type DOMString
, readonlynull
if the server cannot be identified by a domain name.
URL
of type DOMString
, readonly
body
of type HTMLElement
BODY
contents, returns the BODY
element, and in frameset documents, this returns the outermost
FRAMESET
element.
images
of type HTMLCollection
, readonlyIMG
elements in a document.
The behavior is limited to IMG
elements for
backwards compatibility.
applets
of type HTMLCollection
, readonlyOBJECT
elements that include
applets and APPLET
(deprecated) elements in
a document.
links
of type HTMLCollection
, readonlyAREA
elements and
anchor (A
) elements in a document
with a value for the href
attribute.
forms
of type HTMLCollection
, readonly
anchors
of type HTMLCollection
, readonlyA
) elements in a document
with a value for the name
attribute.Note. For reasons of backwards
compatibility, the returned set of anchors only contains those anchors created with the name
attribute, not those created with the id
attribute.
cookie
of type DOMString
name=value;expires=date
.
open
close
open()
and forces rendering.write
open()
. The text is parsed into the document's structure
model.
| The string to be parsed into some structure in the document structure model. |
writeln
open()
. The text is parsed into the
document's structure model.
| The string to be parsed into some structure in the document structure model. |
getElementsByName
HTML attributes are exposed as properties on the element object. The name of the exposed property always uses the naming conventions, and is independent of the case of the attribute in the source document. The data type of the property is determined by the type of the attribute as determined by the HTML 4.0 transitional and frameset DTDs. The attributes have the semantics (including case-sensitivity) given in the HTML 4.0 specification.
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, as is required both for XML and potentially for future
versions of HTML. 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 |
The return value of an attribute that has a data type that is a
value list is always capitalized, 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" then it is
returned as "Left". For attributes with the CDATA
data type, the case of the return value is that given in
the source document.
To avoid name-space conflicts, an attribute with the same
name as a keyword in one of our chosen binding languages is
prefixed. For HTML, the prefix used is "html".
For example, the for
attribute of the
LABEL
element
collides with loop construct naming conventions and is renamed
htmlFor
.
tagName
)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
.
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 Document Object Model CSS.
interface HTMLElement : Element { attribute DOMString id; attribute DOMString title; attribute DOMString lang; attribute DOMString dir; attribute DOMString className; };
id
of type DOMString
title
of type DOMString
lang
of type DOMString
dir
of type DOMString
className
of type DOMString
Root of an HTML document. See the HTML element definition in HTML 4.0.
interface HTMLHtmlElement : HTMLElement { attribute DOMString version; };
version
of type DOMString
Document head information. See the HEAD element definition in HTML 4.0.
interface HTMLHeadElement : HTMLElement { attribute DOMString profile; };
profile
of type DOMString
The 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.0 (see also the LinkStyle
interface in the Document Object Model StyleSheets module).
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; };
disabled
of type boolean
charset
of type DOMString
href
of type DOMString
hreflang
of type DOMString
media
of type DOMString
rel
of type DOMString
rev
of type DOMString
target
of type DOMString
type
of type DOMString
The document title. See the TITLE element definition in HTML 4.0.
This contains generic meta-information about the document. See the META element definition in HTML 4.0.
interface HTMLMetaElement : HTMLElement { attribute DOMString content; attribute DOMString httpEquiv; attribute DOMString name; attribute DOMString scheme; };
content
of type DOMString
httpEquiv
of type DOMString
name
of type DOMString
scheme
of type DOMString
Document base URI. See the BASE element definition in HTML 4.0.
interface HTMLBaseElement : HTMLElement { attribute DOMString href; attribute DOMString target; };
href
of type DOMString
target
of type DOMString
This element is used for single-line text input. See the ISINDEX element definition in HTML 4.0. This element is deprecated in HTML 4.0.
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 DOMString
Style information. See the STYLE
element definition in HTML 4.0, the Document Object Model CSS module and
the LinkStyle
interface in the Document Object Model StyleSheets module.
interface HTMLStyleElement : HTMLElement { attribute boolean disabled; attribute DOMString media; attribute DOMString type; };
disabled
of type boolean
media
of type DOMString
type
of type DOMString
The 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.0.
interface HTMLBodyElement : HTMLElement { attribute DOMString aLink; attribute DOMString background; attribute DOMString bgColor; attribute DOMString link; attribute DOMString text; attribute DOMString vLink; };
aLink
of type DOMString
background
of type DOMString
bgColor
of type DOMString
link
of type DOMString
text
of type DOMString
vLink
of type DOMString
The FORM
element encompasses behavior similar to a
collection and an element. It provides direct access to the contained
input elements as well as the attributes of the form element. See the FORM element definition in HTML 4.0.
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(); };
elements
of type HTMLCollection
, readonly
length
of type long
, readonly
name
of type DOMString
acceptCharset
of type DOMString
action
of type DOMString
enctype
of type DOMString
method
of type DOMString
target
of type DOMString
The 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.0.
interface HTMLSelectElement : HTMLElement { readonly attribute DOMString type; attribute long selectedIndex; attribute DOMString value; readonly attribute long length; readonly attribute HTMLFormElement form; readonly attribute HTMLCollection options; attribute boolean disabled; attribute boolean multiple; attribute DOMString name; attribute long size; attribute long tabIndex; void add(in HTMLElement element, in HTMLElement before); void remove(in long index); void blur(); void focus(); };
type
of type DOMString
, readonlytrue
and
the string "select-one" when false
.
selectedIndex
of type long
value
of type DOMString
length
of type long
, readonlySELECT
.
form
of type HTMLFormElement
, readonlyFORM
element containing this control.
Returns null
if this control is not within the context of a form.
options
of type HTMLCollection
, readonlyOPTION
elements contained by this element.
disabled
of type boolean
multiple
of type boolean
OPTION
elements may
be selected in this SELECT
. See the multiple attribute definition in HTML 4.0.
name
of type DOMString
size
of type long
tabIndex
of type long
add
OPTION
elements
for this SELECT
.
| The element to add. | |||
| The element to insert before, or |
remove
OPTION
elements
for this SELECT
. Does nothing if no element has the given
index.
|
| The index of the item to remove, starting from 0. |
blur
focus
Group options together in logical subdivisions. See the OPTGROUP element definition in HTML 4.0.
interface HTMLOptGroupElement : HTMLElement { attribute boolean disabled; attribute DOMString label; };
disabled
of type boolean
label
of type DOMString
A selectable choice. See the OPTION element definition in HTML 4.0.
interface HTMLOptionElement : HTMLElement { readonly attribute HTMLFormElement form; attribute boolean defaultSelected; readonly attribute DOMString text; readonly attribute long index; attribute boolean disabled; attribute DOMString label; attribute boolean selected; attribute DOMString value; };
form
of type HTMLFormElement
, readonlyFORM
element containing this control.
Returns null
if this control is not within the context of a form.
defaultSelected
of type boolean
defaultSelected
, however, resets the
state of the form control. See the selected attribute definition in HTML 4.0.
text
of type DOMString
, readonly
index
of type long
, readonlyOPTION
in its parent
SELECT
, starting from 0.
disabled
of type boolean
label
of type DOMString
selected
of type boolean
value
of type DOMString
Form control. Note. Depending upon the environment 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.0.
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; attribute DOMString size; attribute DOMString src; attribute long tabIndex; readonly attribute DOMString type; attribute DOMString useMap; attribute DOMString value; void blur(); void focus(); void select(); void click(); };
defaultValue
of type DOMString
type
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. Changing this attribute, however, resets the
contents of the form control. See the value attribute definition in HTML 4.0.
defaultChecked
of type boolean
type
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. Changes to this
attribute, however, resets the state of the form control. See the checked attribute definition in HTML 4.0.
form
of type HTMLFormElement
, readonlyFORM
element containing this control.
Returns null
if this control is not within the context of a form.
accept
of type DOMString
accessKey
of type DOMString
align
of type DOMString
alt
of type DOMString
checked
of type boolean
type
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
changes the state of the form control, but does not change the value of
the HTML value attribute of the element.
disabled
of type boolean
maxLength
of type long
type
has the value "Text" or "Password". See the maxlength attribute definition in HTML 4.0.
name
of type DOMString
readOnly
of type boolean
type
has the value "text"
or "password" only. See the readonly attribute definition in HTML 4.0.
size
of type DOMString
src
of type DOMString
type
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.0.
tabIndex
of type long
type
of type DOMString
, readonly
useMap
of type DOMString
value
of type DOMString
type
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.0.
blur
focus
select
INPUT
elements
whose type
attribute has one of the following values:
"Text", "File", or "Password".click
INPUT
elements whose
type
attribute has one of the following
values: "Button", "Checkbox", "Radio", "Reset", or "Submit".Multi-line text field. See the TEXTAREA element definition in HTML 4.0.
interface HTMLTextAreaElement : HTMLElement { 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(); };
defaultValue
of type DOMString
form
of type HTMLFormElement
, readonlyFORM
element containing this control.
Returns null
if this control is not within the context of a form.
accessKey
of type DOMString
cols
of type long
disabled
of type boolean
name
of type DOMString
readOnly
of type boolean
rows
of type long
tabIndex
of type long
type
of type DOMString
, readonly
value
of type DOMString
DOMString
, the implementation may truncate the
data.
Push button. See the BUTTON element definition in HTML 4.0.
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; };
form
of type HTMLFormElement
, readonlyFORM
element containing this control.
Returns null
if this control is not within the context of a form.
accessKey
of type DOMString
disabled
of type boolean
name
of type DOMString
tabIndex
of type long
type
of type DOMString
, readonly
value
of type DOMString
Form field label text. See the LABEL element definition in HTML 4.0.
interface HTMLLabelElement : HTMLElement { readonly attribute HTMLFormElement form; attribute DOMString accessKey; attribute DOMString htmlFor; };
form
of type HTMLFormElement
, readonlyFORM
element containing this control.
Returns null
if this control is not within the context of a form.
accessKey
of type DOMString
htmlFor
of type DOMString
id
attribute. See the for attribute definition in HTML 4.0.
Organizes form controls into logical groups. See the FIELDSET element definition in HTML 4.0.
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.0.
interface HTMLLegendElement : HTMLElement { readonly attribute HTMLFormElement form; attribute DOMString accessKey; attribute DOMString align; };
form
of type HTMLFormElement
, readonlyFORM
element containing this control.
Returns null
if this control is not within the context of a form.
accessKey
of type DOMString
align
of type DOMString
FIELDSET
. See the align attribute definition in HTML 4.0. This attribute is deprecated in HTML 4.0.
Unordered list. See the UL element definition in HTML 4.0.
interface HTMLUListElement : HTMLElement { attribute boolean compact; attribute DOMString type; };
compact
of type boolean
type
of type DOMString
Ordered list. See the OL element definition in HTML 4.0.
interface HTMLOListElement : HTMLElement { attribute boolean compact; attribute long start; attribute DOMString type; };
compact
of type boolean
start
of type long
type
of type DOMString
Definition list. See the DL element definition in HTML 4.0.
interface HTMLDListElement : HTMLElement { attribute boolean compact; };
compact
of type boolean
Directory list. See the DIR element definition in HTML 4.0. This element is deprecated in HTML 4.0.
interface HTMLDirectoryElement : HTMLElement { attribute boolean compact; };
compact
of type boolean
Menu list. See the MENU element definition in HTML 4.0. This element is deprecated in HTML 4.0.
interface HTMLMenuElement : HTMLElement { attribute boolean compact; };
compact
of type boolean
List item. See the LI element definition in HTML 4.0.
interface HTMLLIElement : HTMLElement { attribute DOMString type; attribute long value; };
type
of type DOMString
value
of type long
OL
See the value attribute definition in HTML 4.0. This attribute is deprecated in HTML 4.0.
Generic block container. See the DIV element definition in HTML 4.0.
interface HTMLDivElement : HTMLElement { attribute DOMString align; };
align
of type DOMString
Paragraphs. See the P element definition in HTML 4.0.
interface HTMLParagraphElement : HTMLElement { attribute DOMString align; };
align
of type DOMString
For the H1
to H6
elements. See the H1 element definition in HTML 4.0.
interface HTMLHeadingElement : HTMLElement { attribute DOMString align; };
align
of type DOMString
For the Q
and BLOCKQUOTE
elements. See the Q element definition in HTML 4.0.
interface HTMLQuoteElement : HTMLElement { attribute DOMString cite; };
cite
of type DOMString
Preformatted text. See the PRE element definition in HTML 4.0.
interface HTMLPreElement : HTMLElement { attribute long width; };
width
of type long
Force a line break. See the BR element definition in HTML 4.0.
interface HTMLBRElement : HTMLElement { attribute DOMString clear; };
clear
of type DOMString
Base font. See the BASEFONT element definition in HTML 4.0. This element is deprecated in HTML 4.0.
interface HTMLBaseFontElement : HTMLElement { attribute DOMString color; attribute DOMString face; attribute DOMString size; };
color
of type DOMString
face
of type DOMString
size
of type DOMString
Local change to font. See the FONT element definition in HTML 4.0. This element is deprecated in HTML 4.0.
interface HTMLFontElement : HTMLElement { attribute DOMString color; attribute DOMString face; attribute DOMString size; };
color
of type DOMString
face
of type DOMString
size
of type DOMString
Create a horizontal rule. See the HR element definition in HTML 4.0.
interface HTMLHRElement : HTMLElement { attribute DOMString align; attribute boolean noShade; attribute DOMString size; attribute DOMString width; };
align
of type DOMString
noShade
of type boolean
size
of type DOMString
width
of type DOMString
Notice of modification to part of a document. See the INS and DEL element definitions in HTML 4.0.
interface HTMLModElement : HTMLElement { attribute DOMString cite; attribute DOMString dateTime; };
cite
of type DOMString
dateTime
of type DOMString
The anchor element. See the A element definition in HTML 4.0.
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 DOMString
charset
of type DOMString
coords
of type DOMString
shape
for the shape of the region. See the coords attribute definition in HTML 4.0.
href
of type DOMString
hreflang
of type DOMString
name
of type DOMString
rel
of type DOMString
rev
of type DOMString
shape
of type DOMString
coords
. See the shape attribute definition in HTML 4.0.
tabIndex
of type long
target
of type DOMString
type
of type DOMString
Embedded image. See the IMG element definition in HTML 4.0.
interface HTMLImageElement : HTMLElement { attribute DOMString lowSrc; attribute DOMString name; attribute DOMString align; attribute DOMString alt; attribute DOMString border; attribute DOMString height; attribute DOMString hspace; attribute boolean isMap; attribute DOMString longDesc; attribute DOMString src; attribute DOMString useMap; attribute DOMString vspace; attribute DOMString width; };
lowSrc
of type DOMString
name
of type DOMString
align
of type DOMString
alt
of type DOMString
border
of type DOMString
height
of type DOMString
hspace
of type DOMString
isMap
of type boolean
longDesc
of type DOMString
src
of type DOMString
useMap
of type DOMString
vspace
of type DOMString
width
of type DOMString
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.0.
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 DOMString hspace; attribute DOMString name; attribute DOMString standby; attribute long tabIndex; attribute DOMString type; attribute DOMString useMap; attribute DOMString vspace; attribute DOMString width; };
form
of type HTMLFormElement
, readonlyFORM
element containing this control.
Returns null
if this control is not within the context of a form.
code
of type DOMString
code
attribute for
HTMLAppletElement.
align
of type DOMString
archive
of type DOMString
border
of type DOMString
codeBase
of type DOMString
classid
, data
, and
archive
attributes. See the codebase attribute definition in HTML 4.0.
codeType
of type DOMString
classid
attribute. See the codetype attribute definition in HTML 4.0.
data
of type DOMString
declare
of type boolean
height
of type DOMString
hspace
of type DOMString
name
of type DOMString
standby
of type DOMString
tabIndex
of type long
type
of type DOMString
data
attribute. See the type attribute definition in HTML 4.0.
useMap
of type DOMString
vspace
of type DOMString
width
of type DOMString
Parameters fed to the OBJECT
element. See the PARAM element definition in HTML 4.0.
interface HTMLParamElement : HTMLElement { attribute DOMString name; attribute DOMString type; attribute DOMString value; attribute DOMString valueType; };
name
of type DOMString
type
of type DOMString
value
attribute when
valuetype
has the value "ref". See the type attribute definition in HTML 4.0.
value
of type DOMString
valueType
of type DOMString
value
attribute
value. See the valuetype attribute definition in HTML 4.0.
An embedded Java applet. See the APPLET element definition in HTML 4.0. This element is deprecated in HTML 4.0.
interface HTMLAppletElement : HTMLElement { attribute DOMString align; attribute DOMString alt; attribute DOMString archive; attribute DOMString code; attribute DOMString codeBase; attribute DOMString height; attribute DOMString hspace; attribute DOMString name; attribute DOMString object; attribute DOMString vspace; attribute DOMString width; };
align
of type DOMString
alt
of type DOMString
archive
of type DOMString
code
of type DOMString
codeBase
of type DOMString
height
of type DOMString
hspace
of type DOMString
name
of type DOMString
object
of type DOMString
vspace
of type DOMString
width
of type DOMString
Client-side image map. See the MAP element definition in HTML 4.0.
interface HTMLMapElement : HTMLElement { readonly attribute HTMLCollection areas; attribute DOMString name; };
areas
of type HTMLCollection
, readonly
name
of type DOMString
usemap
). See the name attribute definition in HTML 4.0.
Client-side image map area definition. See the AREA element definition in HTML 4.0.
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 DOMString
alt
of type DOMString
coords
of type DOMString
shape
for the shape of the region. See the coords attribute definition in HTML 4.0.
href
of type DOMString
noHref
of type boolean
shape
of type DOMString
coords
. See the shape attribute definition in HTML 4.0.
tabIndex
of type long
target
of type DOMString
Script statements. See the SCRIPT element definition in HTML 4.0.
interface HTMLScriptElement : HTMLElement { attribute DOMString text; attribute DOMString htmlFor; attribute DOMString event; attribute DOMString charset; attribute boolean defer; attribute DOMString src; attribute DOMString type; };
text
of type DOMString
htmlFor
of type DOMString
event
of type DOMString
charset
of type DOMString
defer
of type boolean
src
of type DOMString
type
of type DOMString
The create* and delete* methods on the table allow authors to construct
and modify tables. HTML 4.0 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.0.
interface HTMLTableElement : HTMLElement { attribute HTMLTableCaptionElement caption; attribute HTMLTableSectionElement tHead; attribute HTMLTableSectionElement tFoot; 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(); HTMLElement insertRow(in long index) raises(DOMException); void deleteRow(in long index) raises(DOMException); };
caption
of type HTMLTableCaptionElement
CAPTION
, or void if none exists.
tHead
of type HTMLTableSectionElement
THEAD
, or
null
if none exists.
tFoot
of type HTMLTableSectionElement
TFOOT
, or
null
if none exists.
rows
of type HTMLCollection
, readonlyTHEAD
, TFOOT
, all
TBODY
elements.
tBodies
of type HTMLCollection
, readonly
align
of type DOMString
bgColor
of type DOMString
border
of type DOMString
cellPadding
of type DOMString
cellSpacing
of type DOMString
frame
of type DOMString
rules
of type DOMString
summary
of type DOMString
width
of type DOMString
createTHead
A new table header element ( |
deleteTHead
createTFoot
A footer element ( |
deleteTFoot
createCaption
A |
deleteCaption
insertRow
index
th row in the table. If index
is
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.0 Recommendation.
|
| The row number where to insert a new row. This index starts from 0 and is relative to all the rows contained inside the table, regardless of section parentage. |
The newly created row. |
INDEX_SIZE_ERR: Raised if the specified index is greater than the number of rows. |
deleteRow
|
| The index of the row to be deleted. This index starts from 0 and is relative to all the rows contained inside the table, regardless of section parentage. |
INDEX_SIZE_ERR: Raised if the specified index is greater than or equal to the number of rows. |
Table caption See the CAPTION element definition in HTML 4.0.
interface HTMLTableCaptionElement : HTMLElement { attribute DOMString align; };
align
of type DOMString
Regroups the COL
and COLGROUP
elements. See the COL element definition in HTML 4.0.
interface HTMLTableColElement : HTMLElement { attribute DOMString align; attribute DOMString ch; attribute DOMString chOff; attribute long span; attribute DOMString vAlign; attribute DOMString width; };
align
of type DOMString
ch
of type DOMString
chOff
of type DOMString
span
of type long
vAlign
of type DOMString
width
of type DOMString
The THEAD
, TFOOT
, and TBODY
elements.
interface HTMLTableSectionElement : HTMLElement { attribute DOMString align; attribute DOMString ch; attribute DOMString chOff; attribute DOMString vAlign; readonly attribute HTMLCollection rows; HTMLElement insertRow(in long index) raises(DOMException); void deleteRow(in long index) raises(DOMException); };
align
of type DOMString
align
attribute for HTMLTheadElement for details.
ch
of type DOMString
chOff
of type DOMString
vAlign
of type DOMString
valign
attribute for HTMLTheadElement for details.
rows
of type HTMLCollection
, readonly
insertRow
index
th row in this
section. If index
is equal to the number of rows in this
section, the new row is appended.
|
| The row number where to insert a new row. This index starts from 0 and is relative only to the rows contained inside this section, not all the rows in the table. |
The newly created row. |
INDEX_SIZE_ERR: Raised if the specified index is greater than the number of rows. |
deleteRow
|
| The index of the row to be deleted. This index starts from 0 and is relative only to the rows contained inside this section, not all the rows in the table. |
INDEX_SIZE_ERR: Raised if the specified index is greater than or equal to the number of rows. |
A row in a table. See the TR element definition in HTML 4.0.
interface HTMLTableRowElement : HTMLElement { readonly attribute long rowIndex; readonly attribute long sectionRowIndex; readonly attribute HTMLCollection cells; attribute DOMString align; attribute DOMString bgColor; attribute DOMString ch; attribute DOMString chOff; attribute DOMString vAlign; HTMLElement insertCell(in long index) raises(DOMException); void deleteCell(in long index) raises(DOMException); };
rowIndex
of type long
, readonly
sectionRowIndex
of type long
, readonlyTHEAD
, TFOOT
, or TBODY
), starting from
0.
cells
of type HTMLCollection
, readonly
align
of type DOMString
bgColor
of type DOMString
ch
of type DOMString
chOff
of type DOMString
vAlign
of type DOMString
insertCell
TD
cell into this row. If
index
is equal to the number of cells, the new cell is
appended
|
| The place to insert the cell, starting from 0. |
The newly created cell. |
INDEX_SIZE_ERR: Raised if the specified |
deleteCell
|
| The index of the cell to delete, starting from 0. |
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.0.
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; };
cellIndex
of type long
, readonly
abbr
of type DOMString
align
of type DOMString
axis
of type DOMString
bgColor
of type DOMString
ch
of type DOMString
chOff
of type DOMString
colSpan
of type long
headers
of type DOMString
id
attribute values for header cells. See the headers attribute definition in HTML 4.0.
height
of type DOMString
noWrap
of type boolean
rowSpan
of type long
scope
of type DOMString
vAlign
of type DOMString
width
of type DOMString
Create a grid of frames. See the FRAMESET element definition in HTML 4.0.
interface HTMLFrameSetElement : HTMLElement { attribute DOMString cols; attribute DOMString rows; };
cols
of type DOMString
rows
of type DOMString
Create a frame. See the FRAME element definition in HTML 4.0.
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; };
frameBorder
of type DOMString
longDesc
of type DOMString
marginHeight
of type DOMString
marginWidth
of type DOMString
name
of type DOMString
target
attribute). See the name attribute definition in HTML 4.0.
noResize
of type boolean
scrolling
of type DOMString
src
of type DOMString
Inline subwindows. See the IFRAME element definition in HTML 4.0.
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; };
align
of type DOMString
frameBorder
of type DOMString
height
of type DOMString
longDesc
of type DOMString
marginHeight
of type DOMString
marginWidth
of type DOMString
name
of type DOMString
target
attribute). See the name attribute definition in HTML 4.0.
scrolling
of type DOMString
src
of type DOMString
width
of type DOMString