Opens a document to collect the output of write or writeln methods.
Syntax
oNewDoc = document.open(sMimeType [, sReplace])
Parameters
sMimeType Required. String that specifies the MIME type. Currently supports "text/html" only. sReplace Optional. 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
See Also