METHOD:
Document::close
document.close(
)
This method closes
an output stream previously opened with the document.open method
and forces data collected from any instances of the document.write
or document.writeln methods to be displayed.
The following code demonstrates this and displays the output stream in
a new window.
Code:
function newWindowTest() {
var message1 = "Hello, world!"
var message2 = "This is a test."
newWindow.document.open("text/html", "replace")
newWindow.document.writeln("message1)
newWindow.document.write("message2)
newWindow.document.close()
}
newWindow=window.open('','','toolbar=no,scrollbars=no,width=200,height=150')
newWindowTest()
Output: (to new window)
"Hello, world! This is a test." |