Javascript examples for DOM:Document open
Document open() Method - Open an output stream with MIME type 'text/html', add some text, then close the output stream:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <script> function myFunction() {/*from www . j a va 2 s. c om*/ var w = window.open('text/html'); w.document.open(); w.document.write("<h1>Hello World!</h1>"); w.document.close(); } </script> </body> </html>