document Object

DHTML, HTML, & CSS

document Object


Represents the HTML document in a given browser window.

Remarks

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. Retrieve the object by applying the document property to a window or an element object. When used by itself, the document object represents the document in the current window.

This object is available in script as of Microsoft® Internet Explorer 3.0.

Windows CE

In Microsoft® Windows® CE, the document object is not available through scripting for a window opened using the open method.

Members

Example

This example uses the document object to check for a document title, and displays the title (if not null) in a message box.

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

This 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>

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
custom, window

Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.