Javascript examples for DOM:Document close
Document close() Method - Using window.open() with document.open() to open an output stream in a new window, add some text, then close the output stream:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <script> function myFunction() {// w ww . ja va 2 s . co m var w = window.open(); w.document.open(); w.document.write("<h1>Hello World!</h1>"); w.document.close(); } </script> </body> </html>