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: alinkColor background
bgColor fgColor linkColor vlinkColor In DOM Level 2, the method
getElementById is inherited from the Document
interface where it was moved.
See also the Document Object Model (DOM) Level 2 Specification.
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public HTMLCollection | getAnchors()
A collection of all the anchor ( |
| public HTMLCollection | getApplets()
A collection of all the |
| public HTMLElement | |
| public String | |
| public String | getDomain()
The domain name of the server that served the document, or
|
| public NodeList | Returns: The matching elements.The elementName)name attribute value for an
element.Returns the (possibly empty) collection of elements whose
|
| public HTMLCollection | |
| public HTMLCollection | |
| public HTMLCollection | getLinks()
A collection of all |
| public String | |
| public String | |
| public String | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void |
| close | back to summary |
|---|---|
| public void close() Closes a document stream opened by | |
| getAnchors | back to summary |
|---|---|
| public HTMLCollection getAnchors() A collection of all the anchor ( | |
| getApplets | back to summary |
|---|---|
| public HTMLCollection getApplets() A collection of all the | |
| getBody | back to summary |
|---|---|
| public HTMLElement getBody() The element that contains the content for the document. In documents
with | |
| getCookie | back to summary |
|---|---|
| public String getCookie() The cookies associated with this document. If there are none, the
value is an empty string. Otherwise, the value is a string: a
semicolon-delimited list of "name, value" pairs for all the cookies
associated with the page. For example,
| |
| getDomain | back to summary |
|---|---|
| public String getDomain() The domain name of the server that served the document, or
| |
| getElementsByName | back to summary |
|---|---|
| public NodeList getElementsByName(String elementName) Returns the (possibly empty) collection of elements whose
| |
| getForms | back to summary |
|---|---|
| public HTMLCollection getForms() A collection of all the forms of a document. | |
| getImages | back to summary |
|---|---|
| public HTMLCollection getImages() A collection of all the | |
| getLinks | back to summary |
|---|---|
| public HTMLCollection getLinks() A collection of all | |
| getReferrer | back to summary |
|---|---|
| public String getReferrer() Returns the URI of the page that linked to this page. The value is an empty string if the user navigated to the page directly (not through a link, but, for example, via a bookmark). | |
| getTitle | back to summary |
|---|---|
| public String getTitle() The title of a document as specified by the | |
| getURL | back to summary |
|---|---|
| public String getURL() The complete URI of the document. | |
| open | back to summary |
|---|---|
| public void open() Note. This method and the ones following allow a user to add to or
replace the structure model of a document using strings of unparsed
HTML. At the time of writing alternate methods for providing similar
functionality for both HTML and XML documents were being considered.
The following methods may be deprecated at some point in the future in
favor of a more general-purpose mechanism.
| |
| setBody | back to summary |
|---|---|
| public void setBody(HTMLElement body) | |
| setCookie | back to summary |
|---|---|
| public void setCookie(String cookie) | |
| setTitle | back to summary |
|---|---|
| public void setTitle(String title) | |
| write | back to summary |
|---|---|
| public void write(String text) Write a string of text to a document stream opened by
| |
| writeln | back to summary |
|---|---|
| public void writeln(String text) Write a string of text followed by a newline character to a document
stream opened by
| |