document.open()

JavaScript1.0+, JScript1.0+ Nav2+, IE3+, Opera3+ Syntax

document.open()
document.open(mimetype)

Description

The open() method of the Document object clears the current document and opens a stream for new data to be placed in the document. This method accepts one argument, mimetype, that specifies what type of data will be written to the document. The argument can be one of the following standard mimetypes: text/html, text/plain, image/gif, image/jpeg, or image/x-bitmap.

Example

Listing 7.155 opens a document with the open() method and then writes text to the document.

Listing 7.155 Open a Document with the open() Method
 <script language="JavaScript"> <!-- Hide document.open() document.write("Stream text to document"); ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.