home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

Document.open() Method

Name

Document.open() Method---begin a new document

Availability

Navigator 2.0, partial support in Internet Explorer 3.0

Synopsis

document.open()
document.open(mimetype)

Arguments

mimetype

An optional string argument that specifies the type of data to be written to and display in document. The value of this argument should be one of the standard MIME types that the browser understands ("text/html", "text/plain", "image/gif", "image/jpeg", "image/x-bitmap" for Navigator) or some other MIME type that can be handled by an installed plug-in. If this argument is omitted, it is taken to be "text/html". This argument is ignored by Internet Explorer 3.0, which always assumes a document of type "text/html".

Returns

nothing

Description

The document.open() method opens a stream to document, so that subsequent document.write() calls can append data to the document. The optional mimetype argument specifies the type of data to be written, and tells the browser how to interpret that data. Note, however that Internet Explorer 3.0 does not support the mimetype argument and always assumes documents of HTML text.

If there is any existing document displayed when the open() method is called, it will be automatically cleared by the call to open() or by the first call to write() or writeln().

After opening a document with open() and writing data to it with write(), you should complete the document by calling close().

Usage

You will usually call Document.open() with no argument, to open an HTML document. Occasionally, a "text/plain" document is useful; for example for a pop-up window of debugging messages.


Previous Home Next
Document.location Book Index Document.plugins

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell