Click to return to the DHTML, HTML     
open Method     parentElement Method     DHTML Methods    
Web Workshop  |  DHTML, HTML & CSS

open Method


Opens a document to collect the output of write or writeln methods.

Syntax

oNewDoc = document.open(sMimeType [, sReplace])

Parameters

sMimeTypeRequired. String that specifies the MIME type. Currently supports "text/html" only.
sReplaceOptional. String that specifies whether the new document being written is to replace the current document in the History list. Otherwise, by default, the document being created does not replace the current document in the History list.

Return Value

Returns a reference to the new document.

Example

This example uses the open method to replace the current document with a new document and display the HTML markup contained in the variable sMarkup.

var oNewDoc = document.open("text/html", "replace");
var sMarkup = "<HTML><HEAD><TITLE>New Document</TITLE><BODY>Hello, world</BODY></HTML>";
oNewDoc.write(sMarkup);
oNewDoc.close();

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:

document

See Also

onbeforeunload



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.