Availability: |
| |||||||
JavaScript syntax: | - | myDocument.open() | ||||||
- | myDocument.open(aMimeType) | |||||||
- | myDocument.open(aMimeType, aReplaceFlag) | |||||||
Argument list: | aMimeType | A text string describing a valid mime types for the document | ||||||
aReplaceFlag | A string containing the word "replace" |
This opens and prepares the document in readiness for a document.write() action.
Although the document.close() is required, the document.open() may be omitted. Some browsers may be permissive enough to allow the document.write() actions to work without a document.open() first but occasionally a browser may fail. It is good coding style to observe the discipline of opening a stream before writing to it.
The optional parameter describes the MIME type of the document to be opened. By default this will be "text/html". The "text/plain" MIME type is useful too. You can, in theory, open any kind of document but most binary formats are just not practical.
Refer to the MIME type topic for details of some available MIME type values.
The DOM level 1 specification suggests that this method may be deprecated in the future.
Prev | Home | Next |
Document.location | Up | Document.parentWindow |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |