document.close()

JavaScript 1.0+, JScript 1.0+ Nav2+, IE 3+, Opera3+ Syntax

document.close()

Description

The close() method closes the output stream to the document. Any output that has not been written prior to calling the method will be displayed.

Example

Listing 7.94 uses the close() method to close the output stream to a document. Notice that a portion of the last paragraph is not displayed until after the close() method is called and the alert box has been displayed.

Listing 7.94 Close Document Output Stream with close() Method
 <html> <script> <!-- Hide //Write some text to the screen and then close the document. document.write("This line is a long line that should wrap around the "); document.write("browser. If it does not wrap ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.