documentdocument*
*



Contents  *



Index  *Topic Contents
*Previous Topic: DL
*Next Topic: DT

document

Description

Represents the HTML document in a given browser window.

Remarks

You use the document object to retrieve information about the document, to examine and modify the HTML elements and text within the document, and to process events.

The document object is available at all times. You can retrieve the object by applying the document property to a window or an element object. If used by itself, document represents the document in the current window.

Examples

The following example checks for a document title and displays the title (if not null) in an alert (message) box.

if (document.title!="") 
    alert("The title is " + document.title)

The following example shows an event handler function that displays the current position of the mouse (relative to the upper-left corner of the document) in the browser's status window.

<HTML>
<HEAD><TITLE>Report mouse moves</TITLE>
<SCRIPT LANGUAGE="JScript">
function reportMove() {
    window.status = "X=" + window.event.x + " Y=" + window.event.y;
}
</SCRIPT>
<BODY onmousemove="reportMove()">
<H1>Welcome!</H1>
</BODY>
</HTML>

Properties

activeElement, alinkColor, bgColor, body, charset, cookie, defaultCharset, domain, expando, fgColor, lastModified, linkColor, location, parentWindow, readyState, referrer, selection, title, URL, vlinkColor

Collections

all, anchors, applets, children, embeds, forms, frames, images, links, plugins, scripts, styleSheets

Methods

clear, close, createElement, createStyleSheet, elementFromPoint, execCommand, open, queryCommandEnabled, queryCommandIndeterm, queryCommandState, queryCommandSupported, queryCommandText, queryCommandValue, ShowHelp, write, writeln

Events

onafterupdate, onbeforeupdate, onclick, ondblclick, ondragstart, onerrorupdate, onhelp, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onreadystatechange, onrowenter, onrowexit, onselectstart


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.