Help Center

Local Navigation

Object: HTMLDocument

Availability

BlackBerry® Device Software version 3.8 or later

Extends

Document

The HTMLDocument object provides access to the HTML hierarchy.

HTMLDocument event handlers

Property name

Type

Description

Status

Availability

onblur

EventListener

Specifies the function to perform when an element loses focus by either the pointer or by tabbed navigation.

writable

4.6 or later

onchange

EventListener

Specifies the function to perform when a form control loses focus after the user has modified the value.

writable

4.6 or later

onclick

EventListener

Specifies the function to perform when the user clicks the trackball or trackwheel on a BlackBerry® device.

writable

3.8 or later

onfocus

EventListener

Specifies the function to perform when an element gains focus by either the pointer or by tabbed navigation.

writable

4.6 or later

onkeydown

EventListener

Specifies the function to perform when a key is pressed down while the pointer is over an element.

writable

4.6 or later

onkeypress

EventListener

Specifies the function to perform when a key is pressed and released while the pointer is over an element.

writable

4.6 or later

onkeyup

EventListener

Specifies the function to perform when a key is released while the pointer is over an element.

writable

4.6 or later

onmousedown

EventListener

Specifies the function to perform when the user depresses the trackwheel or trackball on a BlackBerry device.

writable

3.8 or later

onmousemove

EventListener

Specifies the function to perform when the user moves the pointer over an element.

writable

4.6 or later

onmouseout

EventListener

Specifies the function to perform when the user moves the pointer off of an element.

writable

4.6 or later

onmouseover

EventListener

Specifies the function to perform when the user moves the pointer over an element.

writable

4.6 or later

onmouseup

EventListener

Specifies the function to perform when the user releases the trackwheel or trackball on a BlackBerry device.

writable

4.6 or later

onreset

EventListener

Specifies the function to perform when the user resets a form.

writable

3.8 or later

onselect

EventListener

Specifies the function to perform when the user selects some text in a text field.

writable

4.6 or later

onsubmit

EventListener

Specifies the function to perform when the user submits a form.

writable

3.8 or later

HTMLDocument properties

Property name

Type

Description

Status

Support level

Availability

anchors

HTMLCollection

Returns an index of the <a> elements contained within the document. Index positions begin at 0 and continue to HTMLCollection.length-1.

read only

DOM 2 HTML

3.8 or later

applets

HTMLCollection

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

DOM 2 HTML

3.8 or later

body

HTMLElement

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

DOM 2 HTML

3.8 or later

compatMode

DOMString

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

HTML 5

3.8 or later

cookie

DOMString

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

DOM 2 HTML

3.8 or later

domain

DOMString

Specifies the domain name from which the document was served.

writable

DOM 2 HTML

3.8 or later

forms

HTMLCollection

Returns an index of the <form> elements contained within the document. Index positions begin at 0 and continue to HTMLCollection.length -1.

read only

DOM 2 HTML

3.8 or later

images

HTMLCollection

Returns an index of the <img> elements contained within the document. Index positions begin at 0 and continue to HTMLCollection.length -1.

read only

DOM 2 HTML

3.8 or later

links

HTMLCollection

Returns an index of the <link> elements contained in the document. Index positions begin at 0 and continue to HTMLCollection.length -1.

read only

DOM 2 HTML

3.8 or later

location

Location

Specifies information about the URI of the document.

writable

HTML 5

3.8 or later

referrer

DOMString

Returns the URL of the document that linked to the active document.

read only

DOM 2 HTML

3.8 or later

title

DOMString

Specifies the text contained within the <title> element of the active document.

writable

DOM 2 HTML

3.8 or later

URL

DOMString

Returns the complete URL of the active document.

read only

DOM 2 HTML

3.8 or later

HTMLDocument methods

Method name

Description

Support level

Availability

close()

Closes the document opened by HTMLDocument.open() and forces rendering.

DOM 2 HTML

3.8 or later

getElementsByName()

Returns an array of all the elements in the document with the specified name.

DOM 2 HTML

4.6 or later

open()

Opens a document stream for writing.

DOM 2 HTML

3.8 or later

write()

Writes a string of text to a document stream opened by HTMLDocument.open().

DOM 2 HTML

3.8 or later

writeln()

Writes a string of text, followed by a new line character to a document stream opened by HTMLDocument.open().

DOM 2 HTML

3.8 or later

Previous topic: HTMLDivElement properties

Was this information helpful? Send us your comments.