Share via


document HTML Object

The document object represents the HTML document in a given browser window or frame. It corresponds to the BODY HTML element.

Note   Frames are supported by Pocket PC compatible devices. SmartPhone does not support frames.

Properties

Property Data type Access Description
alinkColor Variant Read/write
Contains the active link color in the specified document.

The color values returned by Pocket Internet Explorer are not prefixed with the number sign character (#).

bgColor Variant Read/write Sets or retrieves the background color of the specified document.

The color values returned by Pocket Internet Explorer are not prefixed with the number sign character (#).

cookie String Read/write Sets or retrieves the string value of a cookie.

Specifies or receives the name=value pairs, plus any of the following values:

expires=date;

Setting no expiration date on a cookie causes it to expire when the browser closes. If you set an expiration date in the future, the cookie is saved across browser sessions. If you set an expiration date in the past, the cookie is deleted. Use GMT format to specify the date.

domain=domainname;

Setting the domain of the cookie allows pages on a domain made up of more than one server to share cookie information.

path=path;

Setting a path for the cookie allows the current document to share cookie information with other pages within the same domain — that is, if the path is set to /thispathname, all pages in /thispathname and in its subfolders can access the same cookie information.

secure;

Setting a cookie as secure means the stored cookie information can be accessed only from a secure environment.

domain String Read/write
Contains the domain that the document is on, which is initially set to the host that the document is on (such as www.pocketpc.com).
fgColor Variant Read/write Sets or retrieves the foreground (text) color of the document.

The color values returned by Pocket Internet Explorer are not prefixed with the number sign character (#).

lastModified String Read-only Contains the time and date the document was last modified.
linkColor Variant Read/write Sets or retrieves the color of the links in the document.

The color values returned by Pocket Internet Explorer are not prefixed with the number sign character (#).

location String Read/write Sets or retrieves the current URL of the document. It is also an object that represents information about the current document.
referrer String Read-only Contains the URL of the document where the current document was linked. In Pocket Internet Explorer, this property always returns an empty string.
Note   Not implemented in Windows Mobile 2002.
title String Read-only Contains the document title.
URL String Read-only Contains the URL for the current document.
vlinkColor Variant Read/write
Contains the color of visited links in a specified document.

The color values returned by Pocket Internet Explorer are not prefixed with the number sign character (#).

Events

Event Description
onload Occurs immediately after the page is loaded.
onunload Occurs immediately before the current page is unloaded — for example, when the user navigates away from the page or refreshes the page.

Methods

Method Syntax Description
clear document.clear Clears the contents of a selection.
Note   Supported only for devices running Windows Mobile 2002 software or later.
close document.close Closes the stream and forces the data written to the document to be displayed.
open document.open(MIMEtype, replace) Opens a stream to a new document so that subsequent calls to document.write can append data to the document.

MIMEtype is an optional String argument that specifies the type of data to write and display in the document.

replace is an optional Variant argument that indicates whether calls to document.write replace existing content in the document.

Note   Supported only for devices running Windows Mobile 2002 software or later.
write document.write(Text) Writes a Text string (which can contain HTML) to the document.
writeln document.writeln(Text) Writes a Text string (which can contain HTML) followed by a carriage return to the document.

Carriage returns are ignored in HTML unless they are in preformatted text.

Collections

The following collections are supported for the document object:

Requirements

Smartphone: Windows Mobile 2002 and later
OS Versions: Windows CE 3.0 and later

Last updated on Friday, April 22, 2005

© 2005 Microsoft Corporation. All rights reserved.

Send feedback on this topic to the authors.