HTML DOM open() Method
Complete Document Object Reference
Definition and Usage
The open() method opens a stream to collect the output from any
document.write or document.writeln methods.
Note: If a document already exists in the
target, it will be cleared. If this method has no arguments, a new window
with about:blank is displayed.
Syntax
document.open(mimetype,replace)
|
| Parameter |
Description |
| mimetype |
Optional. Specifies the type of document you are writing
to. Default value is "text/html" |
| replace |
Optional. When set, it causes the history entry for the new
document to inherit the history entry from the parent document |
Example
<html>
<head>
<script type="text/javascript">
function createNewDoc()
{
var newDoc=document.open("text/html","replace");
var txt="<html><body>Learning about the DOM is FUN!</body></html>";
newDoc.write(txt);
newDoc.close();
}
</script>
</head>
<body>
<input type="button" value="Write to a new document"
onclick="createNewDoc()">
</body>
</html>
|
Try-It-Yourself Demos
Open a
new document, add some text, then close it
Open a
new document in a new window and add some text
Complete Document Object Reference
Want To Be A Web Master?
If you want to be a Web Master, you will have to host your web site with an ISP (Internet Service Provider).
MaximumASP offers seven different configurations of dedicated servers to meet your Windows and .NET hosting needs.
Hosted on our multi-tiered Enterprise Class network, these servers provide the performance, security and reliability
you need to host your high end web sites and applications.
Visit MaximumASP
|