Object: HTMLDocument
HTMLDocument properties
Property name |
Type |
Description |
Status |
Availability |
|---|---|---|---|---|
anchors |
Returns an index of the <a> elements contained within the document. Index positions begin at 0 and continue to HTMLCollection.length-1. |
read only |
3.8 or later |
|
applets |
Returns an index of the <applet> elements and <object> elements containing applets contained within the document. Index positions begin at 0 and continue to HTMLCollection.length -1. |
read only |
3.8 or later |
|
body |
Returns the element that contains the content of the document. In documents with <body> elements, returns the <body> element. In frameset documents, returns the outermost <frameset> element. This property is writable. However, be aware that specifying a new value for this property effectively removes all the renderable content of the document. |
writable |
3.8 or later |
|
compatMode |
String |
Returns whether or not this document is rendered in strict mode. A value of “CSS1Compat” indicates strict mode is enforced. A value of “BackCompat” indicates that strict mode is not enforced. |
read only |
3.8 or later |
cookie |
String |
When the BlackBerry® Browser reads this property, it returns a semicolon-separated list of the name-value pairs of all visible and unexpired cookies associated with the document or frame. When you set a value for this property, each new value must be a single name-value pair followed by zero or more cookie attributes. If the specified name is already associated with a cookie, the new value and attributes replace the old value and attributes. If the value you specify does not adhere to correct cookie syntax, this property throws a SYNTAX_ERR. |
writable |
3.8 or later |
domain |
String |
Specifies the domain name from which the document was served. |
writable |
3.8 or later |
forms |
Returns an index of the <form> elements contained within the document. Index positions begin at 0 and continue to HTMLCollection.length -1. |
read only |
3.8 or later |
|
images |
Returns an index of the <img> elements contained within the document. Index positions begin at 0 and continue to HTMLCollection.length -1. |
read only |
3.8 or later |
|
links |
Returns an index of the <link> elements contained in the document. Index positions begin at 0 and continue to HTMLCollection.length -1. |
read only |
3.8 or later |
|
location |
Specifies information about the URI of the document. |
writable |
3.8 or later |
|
referrer |
String |
Returns the URL of the document that linked to the active document. |
read only |
3.8 or later |
title |
String |
Specifies the text contained within the <title> element of the active document. |
writable |
3.8 or later |
URL |
String |
Returns the complete URL of the active document. |
read only |
3.8 or later |
HTMLDocument event handlers
HTMLDocument methods
Method name |
Description |
Availability |
|---|---|---|
Closes the document opened by HTMLDocument.open() and forces rendering. |
3.8 or later |
|
Returns an array of all the elements in the document with the specified name. |
4.6 or later |
|
Opens a document stream for writing. |
3.8 or later |
|
Writes a string of text to a document stream opened by HTMLDocument.open(). |
3.8 or later |
|
Writes a string of text, followed by a new line character to a document stream opened by HTMLDocument.open(). |
3.8 or later |
Method: HTMLDocument.close()
The close() method closes the document opened by HTMLDocument.open() and forces rendering.
Method: HTMLDocument.getElementByName()
The getElementByName() method returns an array of the elements in the document with the specified name.
This method behaves differently depending on the document type:
If the document is an HTML document, this method returns all elements with the specified name. When searching HTML documents, this element is case-insensitive.
If the document is an XHTML document, this method only returns form control elements with the specified name. When searching XHTML documents, this method is case sensitive.
Return values
Returns a new NodeList object containing an array of all the elements with the given name. If the document is an XHTML document, only form control elements (<button>, <input>, <select>, <textarea>) with the given name are returned.
Method: HTMLDocument.open()
Method: HTMLDocument.write()
The write() method writes a string of text to a document stream opened by HTMLDocument.open().
Method: HTMLDocument.writeln()
The writeln() method writes a string of text, followed by a new line character to a document stream opened by HTMLDocument.open().