This specification defines the Document Object Model Level 2 HTML, a platform- and language-neutral interface that allows programs and scripts to dynamically access and update the content and structure of [HTML 4.01] and [XHTML 1.0] documents. The Document Object Model Level 2 HTML builds on the Document Object Model Level 2 Core [DOM Level 2 Core] and is not backward compatible with DOM Level 1 HTML [DOM Level 1].
Copyright NoticeCopyright © 2003 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved.
This document is published under the W3C Document Copyright Notice and License. The bindings within this document are published under the W3C Software Copyright Notice and License. The software license requires "Notice of any changes or modifications to the W3C files, including the date changes were made." Consequently, modified versions of the DOM bindings must document that they do not conform to the W3C standard; in the case of the IDL definitions, the pragma prefix can no longer be 'w3c.org'; in the case of the Java Language binding, the package names can no longer be in the 'org.w3c' package.
W3C Document Copyright Notice and LicenseNote: This section is a copy of the W3C Document Notice and License and could be found at http://www.w3.org/Consortium/Legal/copyright-documents-19990405.
Copyright © 1994-2003 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved.
http://www.w3.org/Consortium/Legal/
Public documents on the W3C site are provided by the copyright holders under the following license. The software or Document Type Definitions (DTDs) associated with W3C specifications are governed by the Software Notice. By using and/or copying this document, or the W3C document from which this statement is linked, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions:
Permission to use, copy, and distribute the contents of this document, or the W3C document from which this statement is linked, in any medium for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the document, or portions thereof, that you use:
When space permits, inclusion of the full text of this NOTICE should be provided. We request that authorship attribution be provided in any software, documents, or other items or products that you create pursuant to the implementation of the contents of this document, or any portion thereof.
No right to create modifications or derivatives of W3C documents is granted pursuant to this license. However, if additional requirements (documented in the Copyright FAQ) are satisfied, the right to create modifications or derivatives is sometimes granted by the W3C to individuals complying with those requirements.
THIS DOCUMENT IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF.
The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to this document or its contents without specific, written prior permission. Title to copyright in this document will at all times remain with copyright holders.
W3C Software Copyright Notice and LicenseNote: This section is a copy of the W3C Software Copyright Notice and License and could be found at http://www.w3.org/Consortium/Legal/copyright-software-19980720
Copyright © 1994-2003 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved.
http://www.w3.org/Consortium/Legal/
This W3C work (including software, documents, or other related items) is being provided by the copyright holders under the following license. By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions:
Permission to use, copy, and modify this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications, that you make:
THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
1. Document Object Model HTMLThis 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.
1.2.1.1. Properties and MethodsThe 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.
1.2.1.2. Non-HTML 4.0 interfaces and attributesWhile 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.
1.3. XHTML and the HTML DOMThe 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.
1.4. Miscellaneous Object DefinitionsAn 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.
length
of type unsigned long
, readonly
item
This method retrieves a node specified by ordinal index. Nodes are numbered in tree order (depth-first traversal order).
Parametersindex
of type unsigned long
0
.
Node
The Node
at the corresponding position upon success. A value of null
is returned if the index is out of range.
No Exceptions
namedItem
This method retrieves a
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.
Parametersname
of type DOMString
Node
to be fetched.
Node
The Node
with a name
or id
attribute whose value corresponds to the specified string. Upon failure (e.g., no node with this name exists), returns null
.
No Exceptions
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
DOMException
NOT_SUPPORTED_ERR: if setting the length is not allowed by the implementation.
item
This method retrieves a node specified by ordinal index. Nodes are numbered in tree order (depth-first traversal order).
Parametersindex
of type unsigned long
Node
The Node
at the corresponding position upon success. A value of null
is returned if the index is out of range.
No Exceptions
namedItem
This method retrieves a
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.
Parametersname
of type DOMString
Node
to be fetched.
Node
The Node
with a name
or id
attribute whose value corresponds to the specified string. Upon failure (e.g., no node with this name exists), returns null
.
No Exceptions
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.
URL
of type DOMString
, readonly
anchors
of type HTMLCollection
, readonly
A
) 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
, readonly
OBJECT
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 DOMString
cookies
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.
Exceptions on settingDOMException
SYNTAX_ERR: If the new value does not adhere to the cookie syntax specified by [IETF RFC 2965].
domain
of type DOMString
, readonly
null
if the server cannot be identified by a domain name.
forms
of type HTMLCollection
, readonly
images
of type HTMLCollection
, readonly
IMG
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
, readonly
AREA
elements and anchor (A
) elements in a document with a value for the href
attribute.
referrer
of type DOMString
, readonly
title
of type DOMString
TITLE
element in the head of the document.
close
Closes a document stream opened by
open()
and forces rendering.
No Parameters
No Return Value
No Exceptions
getElementsByName
With [
HTML 4.01] documents, this method returns the (possibly empty) collection of elements whose
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.
ParameterselementName
of type DOMString
name
attribute value for an element.
NodeList
The matching elements.
No Exceptions
open
Open a document stream for writing. If a document exists in the target, this method clears it.
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]).
No Parameters
No Return Value
No Exceptions
write
Write a string of text to a document stream opened by
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.
Parameterstext
of type DOMString
No Return Value
No Exceptions
writeln
Write a string of text followed by a newline character to a document stream opened by
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
Parameterstext
of type DOMString
No Return Value
No Exceptions
HTML 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.
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.
1.6.2. Naming ExceptionsTo 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].
className
of type DOMString
dir
of type DOMString
id
of type DOMString
lang
of type DOMString
title
of type DOMString
Root of an HTML document. See the HTML element definition in HTML 4.01.
version
of type DOMString
Document head information. See the HEAD element definition in HTML 4.01.
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.01 (see also the LinkStyle
interface in the StyleSheet module [DOM Level 2 Style Sheets and CSS]).
charset
of type DOMString
disabled
of type boolean
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.01.
text
of type DOMString
This contains generic meta-information about the document. See the META element definition in HTML 4.01.
content
of type DOMString
httpEquiv
of type DOMString
name
of type DOMString
scheme
of type DOMString
Document base URI [IETF RFC 2396]. See the BASE element definition in HTML 4.01.
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.01. This element is deprecated in HTML 4.01.
form
of type HTMLFormElement
, readonly
FORM
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.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].
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.01.
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 form controls as well as the attributes of the form element. See the FORM element definition in HTML 4.01.
acceptCharset
of type DOMString
action
of type DOMString
elements
of type HTMLCollection
, readonly
enctype
of type DOMString
Note: 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
, readonly
method
of type DOMString
name
of type DOMString
target
of type DOMString
reset
Restores a form element's default values. It performs the same action as a reset button.
No Parameters
No Return Value
No Exceptions
submit
Submits the form. It performs the same action as a submit button.
No Parameters
No Return Value
No Exceptions
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.01.
disabled
of type boolean
form
of type HTMLFormElement
, readonly
FORM
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 2
SELECT
.
DOMException
NOT_SUPPORTED_ERR: if setting the length is not allowed by the implementation.
multiple
of type boolean
OPTION
elements may be selected in this SELECT
. See the multiple attribute definition in HTML 4.01.
name
of type DOMString
options
of type HTMLOptionsCollection
, readonly, modified in DOM Level 2
OPTION
elements contained by this element.
selectedIndex
of type long
size
of type long
tabIndex
of type long
type
of type DOMString
, readonly
true
and the string "select-one" when false
.
value
of type DOMString
add
Add a new element to the collection of
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
.
Parameterselement
of type HTMLElement
before
of type HTMLElement
null
for the tail of the list.
DOMException
NOT_FOUND_ERR: Raised if before
is not a descendant of the SELECT
element.
No Return Value
blur
Removes keyboard focus from this element.
No Parameters
No Return Value
No Exceptions
focus
Gives keyboard focus to this element.
No Parameters
No Return Value
No Exceptions
remove
Remove an element from the collection of
OPTION
elements for this
SELECT
. Does nothing if no element has the given index.
Parametersindex
of type long
No Return Value
No Exceptions
Group options together in logical subdivisions. See the OPTGROUP element definition in HTML 4.01.
disabled
of type boolean
label
of type DOMString
A selectable choice. See the OPTION element definition in HTML 4.01.
defaultSelected
of type boolean
, modified in DOM Level 2
disabled
of type boolean
form
of type HTMLFormElement
, readonly
FORM
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 2
OPTION
in its parent SELECT
, starting from 0.
label
of type DOMString
selected
of type boolean
text
of type DOMString
, readonly
value
of type DOMString
Form 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].
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 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 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. See the checked attribute definition in HTML 4.01.
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. See the value attribute definition in HTML 4.01.
disabled
of type boolean
form
of type HTMLFormElement
, readonly
FORM
element containing this control. Returns null
if this control is not within the context of a form.
maxLength
of type long
type
has the value "text" or "password". See the maxlength attribute definition in HTML 4.01.
name
of type DOMString
readOnly
of type boolean
type
has the value "text" or "password". See the readonly attribute definition in HTML 4.01.
size
of type unsigned long
, modified in DOM Level 2
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.01.
tabIndex
of type long
type
of type DOMString
, modified in DOM Level 2
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.01.
blur
Removes keyboard focus from this element.
No Parameters
No Return Value
No Exceptions
click
Simulate a mouse-click. For
INPUT
elements whose
type
attribute has one of the following values: "button", "checkbox", "radio", "reset", or "submit".
No Parameters
No Return Value
No Exceptions
focus
Gives keyboard focus to this element.
No Parameters
No Return Value
No Exceptions
select
Select the contents of the text area. For
INPUT
elements whose
type
attribute has one of the following values: "text", "file", or "password".
No Parameters
No Return Value
No Exceptions
Multi-line text field. See the TEXTAREA element definition in HTML 4.01.
accessKey
of type DOMString
cols
of type long
defaultValue
of type DOMString
, modified in DOM Level 2
disabled
of type boolean
form
of type HTMLFormElement
, readonly
FORM
element containing this control. Returns null
if this control is not within the context of a form.
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.
blur
Removes keyboard focus from this element.
No Parameters
No Return Value
No Exceptions
focus
Gives keyboard focus to this element.
No Parameters
No Return Value
No Exceptions
select
Select the contents of the
TEXTAREA
.
No Parameters
No Return Value
No Exceptions
Push button. See the BUTTON element definition in HTML 4.01.
accessKey
of type DOMString
disabled
of type boolean
form
of type HTMLFormElement
, readonly
FORM
element containing this control. Returns null
if this control is not within the context of a form.
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.01.
accessKey
of type DOMString
form
of type HTMLFormElement
, readonly
FORM
element containing this control. Returns null
if this control is not within the context of a form.
htmlFor
of type DOMString
id
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.
form
of type HTMLFormElement
, readonly
FORM
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.
accessKey
of type DOMString
align
of type DOMString
FIELDSET
. See the align attribute definition in HTML 4.01. This attribute is deprecated in HTML 4.01.
form
of type HTMLFormElement
, readonly
FORM
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.
compact
of type boolean
type
of type DOMString
Ordered list. See the OL element definition in HTML 4.01.
compact
of type boolean
start
of type long
type
of type DOMString
Definition list. See the DL element definition in HTML 4.01.
compact
of type boolean
Directory list. See the DIR element definition in HTML 4.01. This element is deprecated in HTML 4.01.
compact
of type boolean
Menu list. See the MENU element definition in HTML 4.01. This element is deprecated in HTML 4.01.
compact
of type boolean
List item. See the LI element definition in HTML 4.01.
type
of type DOMString
value
of type long
OL
. 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.
align
of type DOMString
Paragraphs. See the P element definition in HTML 4.01.
align
of type DOMString
For the H1
to H6
elements. See the H1 element definition in HTML 4.01.
align
of type DOMString
For the Q
and BLOCKQUOTE
elements. See the Q element definition in HTML 4.01.
cite
of type DOMString
Preformatted text. See the PRE element definition in HTML 4.01.
width
of type long
Force a line break. See the BR element definition in HTML 4.01.
clear
of type DOMString
Base font. See the BASEFONT element definition in HTML 4.01. This element is deprecated in HTML 4.01.
color
of type DOMString
face
of type DOMString
size
of type long
, modified in DOM Level 2
Local change to font. See the FONT element definition in HTML 4.01. This element is deprecated in HTML 4.01.
color
of type DOMString
face
of type DOMString
size
of type DOMString
Create a horizontal rule. See the HR element definition in HTML 4.01.
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.01.
cite
of type DOMString
dateTime
of type DOMString
The anchor element. See the A element definition in HTML 4.01.
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.01.
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.01.
tabIndex
of type long
target
of type DOMString
type
of type DOMString
blur
Removes keyboard focus from this element.
No Parameters
No Return Value
No Exceptions
focus
Gives keyboard focus to this element.
No Parameters
No Return Value
No Exceptions
Embedded 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 DOMString
alt
of type DOMString
border
of type DOMString
DOMString
in DOM Level 1 HTML [DOM Level 1].
height
of type long
, modified in DOM Level 2
DOMString
in DOM Level 1 HTML [DOM Level 1].
hspace
of type long
, modified in DOM Level 2
DOMString
in DOM Level 1 HTML [DOM Level 1].
isMap
of type boolean
longDesc
of type DOMString
name
of type DOMString
src
of type DOMString
useMap
of type DOMString
vspace
of type long
, modified in DOM Level 2
width
of type long
, modified in DOM Level 2
DOMString
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].
align
of type DOMString
archive
of type DOMString
border
of type DOMString
code
of type DOMString
code
attribute for HTMLAppletElement.
codeBase
of type DOMString
classid
, data
, and archive
attributes. See the codebase attribute definition in HTML 4.01.
codeType
of type DOMString
classid
attribute. See the codetype attribute definition in HTML 4.01.
contentDocument
of type Document
, readonly, introduced in DOM Level 2
null
otherwise.
data
of type DOMString
declare
of type boolean
form
of type HTMLFormElement
, readonly
FORM
element containing this control. Returns null
if this control is not within the context of a form.
height
of type DOMString
hspace
of type long
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.01.
useMap
of type DOMString
vspace
of type long
width
of type DOMString
Parameters fed to the OBJECT
element. See the PARAM element definition in HTML 4.01.
name
of type DOMString
type
of type DOMString
value
attribute when valuetype
has the value "ref". See the type attribute definition in HTML 4.01.
value
of type DOMString
valueType
of type DOMString
value
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.
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 long
, modified in DOM Level 2
name
of type DOMString
object
of type DOMString
, modified in DOM Level 2
vspace
of type long
, modified in DOM Level 2
width
of type DOMString
Client-side image map. See the MAP element definition in HTML 4.01.
areas
of type HTMLCollection
, readonly
name
of type DOMString
usemap
). See the name attribute definition in HTML 4.01.
Client-side image map area definition. See the AREA element definition in HTML 4.01.
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.01.
href
of type DOMString
noHref
of type boolean
shape
of type DOMString
coords
. See the shape attribute definition in HTML 4.01.
tabIndex
of type long
target
of type DOMString
Script statements. See the SCRIPT element definition in HTML 4.01.
charset
of type DOMString
defer
of type boolean
event
of type DOMString
htmlFor
of type DOMString
src
of type DOMString
text
of type DOMString
type
of type DOMString
The 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.
align
of type DOMString
bgColor
of type DOMString
border
of type DOMString
caption
of type HTMLTableCaptionElement
, modified in DOM Level 2
CAPTION
, or void if none exists.
DOMException
HIERARCHY_REQUEST_ERR: if the element is not a CAPTION
.
cellPadding
of type DOMString
cellSpacing
of type DOMString
frame
of type DOMString
rows
of type HTMLCollection
, readonly
THEAD
, TFOOT
, all TBODY
elements.
rules
of type DOMString
summary
of type DOMString
tBodies
of type HTMLCollection
, readonly
tFoot
of type HTMLTableSectionElement
, modified in DOM Level 2
TFOOT
, or null
if none exists.
DOMException
HIERARCHY_REQUEST_ERR: if the element is not a TFOOT
.
tHead
of type HTMLTableSectionElement
, modified in DOM Level 2
THEAD
, or null
if none exists.
DOMException
HIERARCHY_REQUEST_ERR: if the element is not a THEAD
.
width
of type DOMString
createCaption
Create a new table caption object or return an existing one.
No Parameters
No Exceptions
createTFoot
Create a table footer row or return an existing one.
No Parameters
No Exceptions
createTHead
Create a table header row or return an existing one.
No Parameters
No Exceptions
deleteCaption
Delete the table caption, if one exists.
No Parameters
No Return Value
No Exceptions
deleteRow
modified in DOM Level 2
Delete a table row.
Parametersindex
of type long
DOMException
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.
No Return Value
deleteTFoot
Delete the footer from the table, if one exists.
No Parameters
No Return Value
No Exceptions
deleteTHead
Delete the header from the table, if one exists.
No Parameters
No Return Value
No Exceptions
insertRow
modified in DOM Level 2
Insert a new empty row in the table. The new row is inserted immediately before and in the same section as the current
index
th 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].
Parametersindex
of type long
DOMException
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.
align
of type DOMString
Regroups the COL
and COLGROUP
elements. See the COL element definition in HTML 4.01.
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.
align
of type DOMString
align
attribute for HTMLTheadElement for details.
ch
of type DOMString
chOff
of type DOMString
rows
of type HTMLCollection
, readonly
vAlign
of type DOMString
valign
attribute for HTMLTheadElement for details.
deleteRow
modified in DOM Level 2
Delete a row from this section.
Parametersindex
of type long
DOMException
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.
No Return Value
insertRow
modified in DOM Level 2
Insert a row into this section. The new row is inserted immediately before the current
index
th row in this section. If
index
is -1 or equal to the number of rows in this section, the new row is appended.
Parametersindex
of type long
DOMException
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.
align
of type DOMString
bgColor
of type DOMString
cells
of type HTMLCollection
, readonly, modified in DOM Level 2
ch
of type DOMString
chOff
of type DOMString
rowIndex
of type long
, readonly, modified in DOM Level 2
rowIndex
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 2
THEAD
, TFOOT
, or TBODY
), starting from 0.
vAlign
of type DOMString
deleteCell
modified in DOM Level 2
Delete a cell from the current row.
Parametersindex
of type long
DOMException
INDEX_SIZE_ERR: Raised if the specified index
is greater than or equal to the number of cells or if the index is a negative number other than -1.
No Return Value
insertCell
modified in DOM Level 2
Insert an empty
TD
cell into this row. If
index
is -1 or equal to the number of cells, the new cell is appended.
Parametersindex
of type long
DOMException
INDEX_SIZE_ERR: Raised if the specified index
is greater than the number of cells or if the index is a negative number other than -1.
The object used to represent the TH
and TD
elements. See the TD element definition in HTML 4.01.
abbr
of type DOMString
align
of type DOMString
axis
of type DOMString
bgColor
of type DOMString
cellIndex
of type long
, readonly
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.01.
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.01.
cols
of type DOMString
rows
of type DOMString
Create a frame. See the FRAME element definition in HTML 4.01.
contentDocument
of type Document
, readonly, introduced in DOM Level 2
null
otherwise.
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.01.
noResize
of type boolean
scrolling
of type DOMString
src
of type DOMString
Inline subwindows. See the IFRAME element definition in HTML 4.01.
align
of type DOMString
contentDocument
of type Document
, readonly, introduced in DOM Level 2
null
otherwise.
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.01.
scrolling
of type DOMString
src
of type DOMString
width
of type DOMString
Note: The DOM Level 2 HTML module is not backward compatible with the DOM Level 1 HTML module.
Document
support for the feature "XML
" as well as "HTML
".
HTMLDocument
getElementById
is now inherited from the Document
interface [DOM Level 2 Core] where it was moved.
HTMLSelectElement
options
was changed from HTMLCollection
to HTMLOptionsCollection
.
length
is no longer readonly and is now unsigned.
HTMLOptionElement
defaultSelected
attribute does not reset the state of the form control.
index
is readonly.
HTMLInputElement
type
is no longer read only.
size
was changed from DOMString
to unsigned long
.
HTMLTextAreaElement
defaultValue
attribute does not reset the contents of the form control.
HTMLBlockquoteElement
BLOCKQUOTE
elements are now supported by the HTMLQuoteElement
interface.
HTMLBaseFontElement
size
is of type long
.
HTMLImageElement
lowSrc
attribute was removed.
height
, hspace
, width
and vspace
were changed from DOMString
to long
.
HTMLObjectElement
contentDocument
was added.
HTMLAppletElement
hspace
and vspace
were changed from DOMString
to long
.
object
returns the value of the HTML object attribute.
HTMLTableElement
caption
, tHead
, tFoot
, insertRow
, and deleteRow
may raise exceptions.
index
uses a logical order, and not a document order.
HTMLTableSectionElement
insertRow
and deleteRow
may raise exceptions.
HTMLTableRowElement
rowIndex
, sectionRowIndex
, and cells
are readonly.
insertCell
and deleteCell
may raise exceptions.
rowIndex
uses a logical order, and not a document order.
HTMLFrameElement
contentDocument
was added.
HTMLIFrameElement
contentDocument
was added.
html2
.
org.w3c.dom.html2
.
This appendix contains the complete Java language [Java] binding for the Level 2 Document Object Model HTML.
The Java files are also available as http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/java-binding.zip
org/w3c/dom/html2/HTMLCollection.java:package org.w3c.dom.html2; import org.w3c.dom.Node; public interface HTMLCollection { public int getLength(); public Node item(int index); public Node namedItem(String name); }org/w3c/dom/html2/HTMLOptionsCollection.java:
package org.w3c.dom.html2; import org.w3c.dom.Node; import org.w3c.dom.DOMException; public interface HTMLOptionsCollection { public int getLength(); public void setLength(int length) throws DOMException; public Node item(int index); public Node namedItem(String name); }org/w3c/dom/html2/HTMLDocument.java:
package org.w3c.dom.html2; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.w3c.dom.DOMException; public interface HTMLDocument extends Document { public String getTitle(); public void setTitle(String title); public String getReferrer(); public String getDomain(); public String getURL(); public HTMLElement getBody(); public void setBody(HTMLElement body); public HTMLCollection getImages(); public HTMLCollection getApplets(); public HTMLCollection getLinks(); public HTMLCollection getForms(); public HTMLCollection getAnchors(); public String getCookie(); public void setCookie(String cookie) throws DOMException; public void open(); public void close(); public void write(String text); public void writeln(String text); public NodeList getElementsByName(String elementName); }org/w3c/dom/html2/HTMLElement.java:
package org.w3c.dom.html2; import org.w3c.dom.Element; public interface HTMLElement extends Element { public String getId(); public void setId(String id); public String getTitle(); public void setTitle(String title); public String getLang(); public void setLang(String lang); public String getDir(); public void setDir(String dir); public String getClassName(); public void setClassName(String className); }org/w3c/dom/html2/HTMLHtmlElement.java:
package org.w3c.dom.html2; public interface HTMLHtmlElement extends HTMLElement { public String getVersion(); public void setVersion(String version); }org/w3c/dom/html2/HTMLHeadElement.java:
package org.w3c.dom.html2; public interface HTMLHeadElement extends HTMLElement { public String getProfile(); public void setProfile(String profile); }org/w3c/dom/html2/HTMLLinkElement.java:
package org.w3c.dom.html2; public interface HTMLLinkElement extends HTMLElement { public boolean getDisabled(); public void setDisabled(boolean disabled); public String getCharset(); public void setCharset(String charset); public String getHref(); public void setHref(String href); public String getHreflang(); public void setHreflang(String hreflang); public String getMedia(); public void setMedia(String media); public String getRel(); public void setRel(String rel); public String getRev(); public void setRev(String rev); public String getTarget(); public void setTarget(String target); public String getType(); public void setType(String type); }org/w3c/dom/html2/HTMLTitleElement.java:
package org.w3c.dom.html2; public interface HTMLTitleElement extends HTMLElement { public String getText(); public void setText(String text); }org/w3c/dom/html2/HTMLMetaElement.java:
package org.w3c.dom.html2; public interface HTMLMetaElement extends HTMLElement { public String getContent(); public void setContent(String content); public String getHttpEquiv(); public void setHttpEquiv(String httpEquiv); public String getName(); public void setName(String name); public String getScheme(); public void setScheme(String scheme); }org/w3c/dom/html2/HTMLBaseElement.java:
package org.w3c.dom.html2; public interface HTMLBaseElement extends HTMLElement { public String getHref(); public void setHref(String href); public String getTarget(); public void setTarget(String target); }org/w3c/dom/html2/HTMLIsIndexElement.java:
package org.w3c.dom.html2; public interface HTMLIsIndexElement extends HTMLElement { public HTMLFormElement getForm(); public String getPrompt(); public void setPrompt(String prompt); }org/w3c/dom/html2/HTMLStyleElement.java:
package org.w3c.dom.html2; public interface HTMLStyleElement extends HTMLElement { public boolean getDisabled(); public void setDisabled(boolean disabled); public String getMedia(); public void setMedia(String media); public String getType(); public void setType(String type); }org/w3c/dom/html2/HTMLBodyElement.java:
package org.w3c.dom.html2; public interface HTMLBodyElement extends HTMLElement { public String getALink(); public void setALink(String aLink); public String getBackground(); public void setBackground(String background); public String getBgColor(); public void setBgColor(String bgColor); public String getLink(); public void setLink(String link); public String getText(); public void setText(String text); public String getVLink(); public void setVLink(String vLink); }org/w3c/dom/html2/HTMLFormElement.java:
package org.w3c.dom.html2; public interface HTMLFormElement extends HTMLElement { public HTMLCollection getElements(); public int getLength(); public String getName(); public void setName(String name); public String getAcceptCharset(); public void setAcceptCharset(String acceptCharset); public String getAction(); public void setAction(String action); public String getEnctype(); public void setEnctype(String enctype); public String getMethod(); public void setMethod(String method); public String getTarget(); public void setTarget(String target); public void submit(); public void reset(); }org/w3c/dom/html2/HTMLSelectElement.java:
package org.w3c.dom.html2; import org.w3c.dom.DOMException; public interface HTMLSelectElement extends HTMLElement { public String getType(); public int getSelectedIndex(); public void setSelectedIndex(int selectedIndex); public String getValue(); public void setValue(String value); public int getLength(); public void setLength(int length) throws DOMException; public HTMLFormElement getForm(); public HTMLOptionsCollection getOptions(); public boolean getDisabled(); public void setDisabled(boolean disabled); public boolean getMultiple(); public void setMultiple(boolean multiple); public String getName(); public void setName(String name); public int getSize(); public void setSize(int size); public int getTabIndex(); public void setTabIndex(int tabIndex); public void add(HTMLElement element, HTMLElement before) throws DOMException; public void remove(int index); public void blur(); public void focus(); }org/w3c/dom/html2/HTMLOptGroupElement.java:
package org.w3c.dom.html2; public interface HTMLOptGroupElement extends HTMLElement { public boolean getDisabled(); public void setDisabled(boolean disabled); public String getLabel(); public void setLabel(String label); }org/w3c/dom/html2/HTMLOptionElement.java:
package org.w3c.dom.html2; public interface HTMLOptionElement extends HTMLElement { public HTMLFormElement getForm(); public boolean getDefaultSelected(); public void setDefaultSelected(boolean defaultSelected); public String getText(); public int getIndex(); public boolean getDisabled(); public void setDisabled(boolean disabled); public String getLabel(); public void setLabel(String label); public boolean getSelected(); public void setSelected(boolean selected); public String getValue(); public void setValue(String value); }org/w3c/dom/html2/HTMLInputElement.java:
package org.w3c.dom.html2; public interface HTMLInputElement extends HTMLElement { public String getDefaultValue(); public void setDefaultValue(String defaultValue); public boolean getDefaultChecked(); public void setDefaultChecked(boolean defaultChecked); public HTMLFormElement getForm(); public String getAccept(); public void setAccept(String accept); public String getAccessKey(); public void setAccessKey(String accessKey); public String getAlign(); public void setAlign(String align); public String getAlt(); public void setAlt(String alt); public boolean getChecked(); public void setChecked(boolean checked); public boolean getDisabled(); public void setDisabled(boolean disabled); public int getMaxLength(); public void setMaxLength(int maxLength); public String getName(); public void setName(String name); public boolean getReadOnly(); public void setReadOnly(boolean readOnly); public int getSize(); public void setSize(int size); public String getSrc(); public void setSrc(String src); public int getTabIndex(); public void setTabIndex(int tabIndex); public String getType(); public void setType(String type); public String getUseMap(); public void setUseMap(String useMap); public String getValue(); public void setValue(String value); public void blur(); public void focus(); public void select(); public void click(); }org/w3c/dom/html2/HTMLTextAreaElement.java:
package org.w3c.dom.html2; public interface HTMLTextAreaElement extends HTMLElement { public String getDefaultValue(); public void setDefaultValue(String defaultValue); public HTMLFormElement getForm(); public String getAccessKey(); public void setAccessKey(String accessKey); public int getCols(); public void setCols(int cols); public boolean getDisabled(); public void setDisabled(boolean disabled); public String getName(); public void setName(String name); public boolean getReadOnly(); public void setReadOnly(boolean readOnly); public int getRows(); public void setRows(int rows); public int getTabIndex(); public void setTabIndex(int tabIndex); public String getType(); public String getValue(); public void setValue(String value); public void blur(); public void focus(); public void select(); }org/w3c/dom/html2/HTMLButtonElement.java:
package org.w3c.dom.html2; public interface HTMLButtonElement extends HTMLElement { public HTMLFormElement getForm(); public String getAccessKey(); public void setAccessKey(String accessKey); public boolean getDisabled(); public void setDisabled(boolean disabled); public String getName(); public void setName(String name); public int getTabIndex(); public void setTabIndex(int tabIndex); public String getType(); public String getValue(); public void setValue(String value); }org/w3c/dom/html2/HTMLLabelElement.java:
package org.w3c.dom.html2; public interface HTMLLabelElement extends HTMLElement { public HTMLFormElement getForm(); public String getAccessKey(); public void setAccessKey(String accessKey); public String getHtmlFor(); public void setHtmlFor(String htmlFor); }org/w3c/dom/html2/HTMLFieldSetElement.java:
package org.w3c.dom.html2; public interface HTMLFieldSetElement extends HTMLElement { public HTMLFormElement getForm(); }org/w3c/dom/html2/HTMLLegendElement.java:
package org.w3c.dom.html2; public interface HTMLLegendElement extends HTMLElement { public HTMLFormElement getForm(); public String getAccessKey(); public void setAccessKey(String accessKey); public String getAlign(); public void setAlign(String align); }org/w3c/dom/html2/HTMLUListElement.java:
package org.w3c.dom.html2; public interface HTMLUListElement extends HTMLElement { public boolean getCompact(); public void setCompact(boolean compact); public String getType(); public void setType(String type); }org/w3c/dom/html2/HTMLOListElement.java:
package org.w3c.dom.html2; public interface HTMLOListElement extends HTMLElement { public boolean getCompact(); public void setCompact(boolean compact); public int getStart(); public void setStart(int start); public String getType(); public void setType(String type); }org/w3c/dom/html2/HTMLDListElement.java:
package org.w3c.dom.html2; public interface HTMLDListElement extends HTMLElement { public boolean getCompact(); public void setCompact(boolean compact); }org/w3c/dom/html2/HTMLDirectoryElement.java:
package org.w3c.dom.html2; public interface HTMLDirectoryElement extends HTMLElement { public boolean getCompact(); public void setCompact(boolean compact); }
package org.w3c.dom.html2; public interface HTMLMenuElement extends HTMLElement { public boolean getCompact(); public void setCompact(boolean compact); }org/w3c/dom/html2/HTMLLIElement.java:
package org.w3c.dom.html2; public interface HTMLLIElement extends HTMLElement { public String getType(); public void setType(String type); public int getValue(); public void setValue(int value); }org/w3c/dom/html2/HTMLDivElement.java:
package org.w3c.dom.html2; public interface HTMLDivElement extends HTMLElement { public String getAlign(); public void setAlign(String align); }org/w3c/dom/html2/HTMLParagraphElement.java:
package org.w3c.dom.html2; public interface HTMLParagraphElement extends HTMLElement { public String getAlign(); public void setAlign(String align); }org/w3c/dom/html2/HTMLHeadingElement.java:
package org.w3c.dom.html2; public interface HTMLHeadingElement extends HTMLElement { public String getAlign(); public void setAlign(String align); }org/w3c/dom/html2/HTMLQuoteElement.java:
package org.w3c.dom.html2; public interface HTMLQuoteElement extends HTMLElement { public String getCite(); public void setCite(String cite); }org/w3c/dom/html2/HTMLPreElement.java:
package org.w3c.dom.html2; public interface HTMLPreElement extends HTMLElement { public int getWidth(); public void setWidth(int width); }org/w3c/dom/html2/HTMLBRElement.java:
package org.w3c.dom.html2; public interface HTMLBRElement extends HTMLElement { public String getClear(); public void setClear(String clear); }org/w3c/dom/html2/HTMLBaseFontElement.java:
package org.w3c.dom.html2; public interface HTMLBaseFontElement extends HTMLElement { public String getColor(); public void setColor(String color); public String getFace(); public void setFace(String face); public int getSize(); public void setSize(int size); }org/w3c/dom/html2/HTMLFontElement.java:
package org.w3c.dom.html2; public interface HTMLFontElement extends HTMLElement { public String getColor(); public void setColor(String color); public String getFace(); public void setFace(String face); public String getSize(); public void setSize(String size); }org/w3c/dom/html2/HTMLHRElement.java:
package org.w3c.dom.html2; public interface HTMLHRElement extends HTMLElement { public String getAlign(); public void setAlign(String align); public boolean getNoShade(); public void setNoShade(boolean noShade); public String getSize(); public void setSize(String size); public String getWidth(); public void setWidth(String width); }org/w3c/dom/html2/HTMLModElement.java:
package org.w3c.dom.html2; public interface HTMLModElement extends HTMLElement { public String getCite(); public void setCite(String cite); public String getDateTime(); public void setDateTime(String dateTime); }org/w3c/dom/html2/HTMLAnchorElement.java:
package org.w3c.dom.html2; public interface HTMLAnchorElement extends HTMLElement { public String getAccessKey(); public void setAccessKey(String accessKey); public String getCharset(); public void setCharset(String charset); public String getCoords(); public void setCoords(String coords); public String getHref(); public void setHref(String href); public String getHreflang(); public void setHreflang(String hreflang); public String getName(); public void setName(String name); public String getRel(); public void setRel(String rel); public String getRev(); public void setRev(String rev); public String getShape(); public void setShape(String shape); public int getTabIndex(); public void setTabIndex(int tabIndex); public String getTarget(); public void setTarget(String target); public String getType(); public void setType(String type); public void blur(); public void focus(); }org/w3c/dom/html2/HTMLImageElement.java:
package org.w3c.dom.html2; public interface HTMLImageElement extends HTMLElement { public String getName(); public void setName(String name); public String getAlign(); public void setAlign(String align); public String getAlt(); public void setAlt(String alt); public String getBorder(); public void setBorder(String border); public int getHeight(); public void setHeight(int height); public int getHspace(); public void setHspace(int hspace); public boolean getIsMap(); public void setIsMap(boolean isMap); public String getLongDesc(); public void setLongDesc(String longDesc); public String getSrc(); public void setSrc(String src); public String getUseMap(); public void setUseMap(String useMap); public int getVspace(); public void setVspace(int vspace); public int getWidth(); public void setWidth(int width); }org/w3c/dom/html2/HTMLObjectElement.java:
package org.w3c.dom.html2; import org.w3c.dom.Document; public interface HTMLObjectElement extends HTMLElement { public HTMLFormElement getForm(); public String getCode(); public void setCode(String code); public String getAlign(); public void setAlign(String align); public String getArchive(); public void setArchive(String archive); public String getBorder(); public void setBorder(String border); public String getCodeBase(); public void setCodeBase(String codeBase); public String getCodeType(); public void setCodeType(String codeType); public String getData(); public void setData(String data); public boolean getDeclare(); public void setDeclare(boolean declare); public String getHeight(); public void setHeight(String height); public int getHspace(); public void setHspace(int hspace); public String getName(); public void setName(String name); public String getStandby(); public void setStandby(String standby); public int getTabIndex(); public void setTabIndex(int tabIndex); public String getType(); public void setType(String type); public String getUseMap(); public void setUseMap(String useMap); public int getVspace(); public void setVspace(int vspace); public String getWidth(); public void setWidth(String width); public Document getContentDocument(); }org/w3c/dom/html2/HTMLParamElement.java:
package org.w3c.dom.html2; public interface HTMLParamElement extends HTMLElement { public String getName(); public void setName(String name); public String getType(); public void setType(String type); public String getValue(); public void setValue(String value); public String getValueType(); public void setValueType(String valueType); }org/w3c/dom/html2/HTMLAppletElement.java:
package org.w3c.dom.html2; public interface HTMLAppletElement extends HTMLElement { public String getAlign(); public void setAlign(String align); public String getAlt(); public void setAlt(String alt); public String getArchive(); public void setArchive(String archive); public String getCode(); public void setCode(String code); public String getCodeBase(); public void setCodeBase(String codeBase); public String getHeight(); public void setHeight(String height); public int getHspace(); public void setHspace(int hspace); public String getName(); public void setName(String name); public String getObject(); public void setObject(String object); public int getVspace(); public void setVspace(int vspace); public String getWidth(); public void setWidth(String width); }org/w3c/dom/html2/HTMLMapElement.java:
package org.w3c.dom.html2; public interface HTMLMapElement extends HTMLElement { public HTMLCollection getAreas(); public String getName(); public void setName(String name); }org/w3c/dom/html2/HTMLAreaElement.java:
package org.w3c.dom.html2; public interface HTMLAreaElement extends HTMLElement { public String getAccessKey(); public void setAccessKey(String accessKey); public String getAlt(); public void setAlt(String alt); public String getCoords(); public void setCoords(String coords); public String getHref(); public void setHref(String href); public boolean getNoHref(); public void setNoHref(boolean noHref); public String getShape(); public void setShape(String shape); public int getTabIndex(); public void setTabIndex(int tabIndex); public String getTarget(); public void setTarget(String target); }org/w3c/dom/html2/HTMLScriptElement.java:
package org.w3c.dom.html2; public interface HTMLScriptElement extends HTMLElement { public String getText(); public void setText(String text); public String getHtmlFor(); public void setHtmlFor(String htmlFor); public String getEvent(); public void setEvent(String event); public String getCharset(); public void setCharset(String charset); public boolean getDefer(); public void setDefer(boolean defer); public String getSrc(); public void setSrc(String src); public String getType(); public void setType(String type); }org/w3c/dom/html2/HTMLTableElement.java:
package org.w3c.dom.html2; import org.w3c.dom.DOMException; public interface HTMLTableElement extends HTMLElement { public HTMLTableCaptionElement getCaption(); public void setCaption(HTMLTableCaptionElement caption) throws DOMException; public HTMLTableSectionElement getTHead(); public void setTHead(HTMLTableSectionElement tHead) throws DOMException; public HTMLTableSectionElement getTFoot(); public void setTFoot(HTMLTableSectionElement tFoot) throws DOMException; public HTMLCollection getRows(); public HTMLCollection getTBodies(); public String getAlign(); public void setAlign(String align); public String getBgColor(); public void setBgColor(String bgColor); public String getBorder(); public void setBorder(String border); public String getCellPadding(); public void setCellPadding(String cellPadding); public String getCellSpacing(); public void setCellSpacing(String cellSpacing); public String getFrame(); public void setFrame(String frame); public String getRules(); public void setRules(String rules); public String getSummary(); public void setSummary(String summary); public String getWidth(); public void setWidth(String width); public HTMLElement createTHead(); public void deleteTHead(); public HTMLElement createTFoot(); public void deleteTFoot(); public HTMLElement createCaption(); public void deleteCaption(); public HTMLElement insertRow(int index) throws DOMException; public void deleteRow(int index) throws DOMException; }org/w3c/dom/html2/HTMLTableCaptionElement.java:
package org.w3c.dom.html2; public interface HTMLTableCaptionElement extends HTMLElement { public String getAlign(); public void setAlign(String align); }org/w3c/dom/html2/HTMLTableColElement.java:
package org.w3c.dom.html2; public interface HTMLTableColElement extends HTMLElement { public String getAlign(); public void setAlign(String align); public String getCh(); public void setCh(String ch); public String getChOff(); public void setChOff(String chOff); public int getSpan(); public void setSpan(int span); public String getVAlign(); public void setVAlign(String vAlign); public String getWidth(); public void setWidth(String width); }org/w3c/dom/html2/HTMLTableSectionElement.java:
package org.w3c.dom.html2; import org.w3c.dom.DOMException; public interface HTMLTableSectionElement extends HTMLElement { public String getAlign(); public void setAlign(String align); public String getCh(); public void setCh(String ch); public String getChOff(); public void setChOff(String chOff); public String getVAlign(); public void setVAlign(String vAlign); public HTMLCollection getRows(); public HTMLElement insertRow(int index) throws DOMException; public void deleteRow(int index) throws DOMException; }org/w3c/dom/html2/HTMLTableRowElement.java:
package org.w3c.dom.html2; import org.w3c.dom.DOMException; public interface HTMLTableRowElement extends HTMLElement { public int getRowIndex(); public int getSectionRowIndex(); public HTMLCollection getCells(); public String getAlign(); public void setAlign(String align); public String getBgColor(); public void setBgColor(String bgColor); public String getCh(); public void setCh(String ch); public String getChOff(); public void setChOff(String chOff); public String getVAlign(); public void setVAlign(String vAlign); public HTMLElement insertCell(int index) throws DOMException; public void deleteCell(int index) throws DOMException; }org/w3c/dom/html2/HTMLTableCellElement.java:
package org.w3c.dom.html2; public interface HTMLTableCellElement extends HTMLElement { public int getCellIndex(); public String getAbbr(); public void setAbbr(String abbr); public String getAlign(); public void setAlign(String align); public String getAxis(); public void setAxis(String axis); public String getBgColor(); public void setBgColor(String bgColor); public String getCh(); public void setCh(String ch); public String getChOff(); public void setChOff(String chOff); public int getColSpan(); public void setColSpan(int colSpan); public String getHeaders(); public void setHeaders(String headers); public String getHeight(); public void setHeight(String height); public boolean getNoWrap(); public void setNoWrap(boolean noWrap); public int getRowSpan(); public void setRowSpan(int rowSpan); public String getScope(); public void setScope(String scope); public String getVAlign(); public void setVAlign(String vAlign); public String getWidth(); public void setWidth(String width); }org/w3c/dom/html2/HTMLFrameSetElement.java:
package org.w3c.dom.html2; public interface HTMLFrameSetElement extends HTMLElement { public String getCols(); public void setCols(String cols); public String getRows(); public void setRows(String rows); }org/w3c/dom/html2/HTMLFrameElement.java:
package org.w3c.dom.html2; import org.w3c.dom.Document; public interface HTMLFrameElement extends HTMLElement { public String getFrameBorder(); public void setFrameBorder(String frameBorder); public String getLongDesc(); public void setLongDesc(String longDesc); public String getMarginHeight(); public void setMarginHeight(String marginHeight); public String getMarginWidth(); public void setMarginWidth(String marginWidth); public String getName(); public void setName(String name); public boolean getNoResize(); public void setNoResize(boolean noResize); public String getScrolling(); public void setScrolling(String scrolling); public String getSrc(); public void setSrc(String src); public Document getContentDocument(); }org/w3c/dom/html2/HTMLIFrameElement.java:
package org.w3c.dom.html2; import org.w3c.dom.Document; public interface HTMLIFrameElement extends HTMLElement { public String getAlign(); public void setAlign(String align); public String getFrameBorder(); public void setFrameBorder(String frameBorder); public String getHeight(); public void setHeight(String height); public String getLongDesc(); public void setLongDesc(String longDesc); public String getMarginHeight(); public void setMarginHeight(String marginHeight); public String getMarginWidth(); public void setMarginWidth(String marginWidth); public String getName(); public void setName(String name); public String getScrolling(); public void setScrolling(String scrolling); public String getSrc(); public void setSrc(String src); public String getWidth(); public void setWidth(String width); public Document getContentDocument(); }Appendix D: ECMAScript Language Binding
This appendix contains the complete ECMAScript [ECMAScript] binding for the Level 2 Document Object Model HTML definitions.
Note: Exceptions handling is only supported by ECMAScript implementation conformant with the Standard ECMA-262 3rd. Edition ([ECMAScript]).
HTMLAnchorElement objects in String
expressions are evaluated as HTMLAnchorElement.href
. For example:
alert(" The absolute URI is " + myAnchorElement);
is equivalent to
alert(" The absolute URI is " + myAnchorElement.href);Appendix E: Acknowledgements
Many people contributed to this specification, including members of the DOM Working Group and the DOM Interest Group. We especially thank the following:
Andy Heninger (IBM), Arnaud Le Hors (W3C and IBM), Bill Smith (Sun), Bill Shea (Merrill Lynch), Chris Lovett (Microsoft), Chris Wilson (Microsoft), David Brownell (Sun), Glenn Adams (ATSC), James Davidson (Sun), Joe Kesselman (IBM), Joe Lapp (webMethods), Joe Marini (Macromedia), Johnny Stenback (Netscape), Jonathan Marsh (Microsoft), Jonathan Robie (Texcel Research and Software AG), Kim Adamson-Sharpe (SoftQuad Software Inc.), Lauren Wood (SoftQuad Software Inc., former Chair), Laurence Cable (Sun), Mark Davis (IBM), Mark Scardina (Oracle), Martin Dürst (W3C), Mick Goulish (Software AG), Mike Champion (Arbortext and Software AG), Miles Sabin (Cromwell Media), Patti Lutsky (Arbortext), Paul Grosso (Arbortext), Peter Sharpe (SoftQuad Software Inc.), Phil Karlton (Netscape), Philippe Le Hégaret (W3C, W3C team contact and former Chair), Ramesh Lekshmynarayanan (Merrill Lynch), Ray Whitmer (iMall, Excite@Home, Netscape and Chair), Rich Rollman (Microsoft), Rick Gessner (Netscape), Tom Pixley (Netscape), Vidur Apparao (Netscape), Vinod Anupam (Lucent).
Thanks to all those who have helped to improve this specification by sending suggestions and corrections.
The W3C tried to produce the most useful and accurate specification as possible but we wouldn't have been able to do so without the help of the DOM Test Suite effort. Special thanks to Curt Arnold, Rick Rivello (NIST), Robert Clary (Netscape) and Dimitris Dimitriadis for the DOM Level 2 HTML Test Suite. The DOM Test Suite is based on the test suite developed by Mary Brady (NIST).
E.1: Production SystemsThis specification was written in XML. The HTML, OMG IDL, Java and ECMAScript bindings were all produced automatically.
This document was generated using DOM Level 2. We used Xerces as the basis DOM implementation and wish to thank the authors. Philippe Le Hégaret and Arnaud Le Hors wrote the Java programs which are the DOM application.
E.2: DOM Level 1The authors of the DOM Level 1 specification, members of the DOM Working Group, deserve much credit for their hard work:
Lauren Wood (SoftQuad, Inc., chair), Arnaud Le Hors (W3C, W3C staff contact), Andrew Watson (Object Management Group), Bill Smith (Sun), Chris Lovett (Microsoft), Chris Wilson (Microsoft), David Brownell (Sun), David Singer (IBM), Don Park (invited), Eric Vasilik (Microsoft), Gavin Nicol (INSO), Ian Jacobs (W3C), James Clark (invited), Jared Sorensen (Novell), Jonathan Robie (Texcel Research and Software AG), Mike Champion (ArborText and Software AG), Paul Grosso (ArborText), Peter Sharpe (SoftQuad, Inc.), Phil Karlton (Netscape), Ray Whitmer (iMall), Rich Rollman (Microsoft), Rick Gessner (Netscape), Robert Sutor (IBM), Scott Isaacs (Microsoft), Sharon Adler (INSO), Steve Byrne (JavaSoft), Tim Bray (invited), Tom Pixley (Netscape), Vidur Apparao (Netscape).
Thanks to Joe English, author of cost for helping so much in allowing us to develop a framework that made the production of this specification possible.
Thanks to Jan Kärrman, author of html2ps for helping so much in creating the Postscript version of the specification.
The editors of the first version of the DOM HTML module were Mike Champion (ArborText), Vidur Apparao (Netscape), Scott Isaacs (Microsoft, January 1998), Chris Wilson (Microsoft, after January 1998), and Ian Jacobs (W3C).
GlossarySeveral of the following term definitions have been borrowed or modified from similar definitions in other W3C or standards documents. See the links within the definitions for more information.
For the latest version of any W3C specification please consult the list of W3C Technical Reports available at http://www.w3.org/TR.
G.1: Normative referencesRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4