HTML DOM close() Method
Complete Document Object Reference
Definition and Usage
The close() method closes an output stream opened with the document.open
method, and displays the collected data.
Syntax
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
|