Javascript examples for DOM:Document write
Document write() Method - use document.write() after an HTML document is fully loaded, will delete all existing HTML.
<!DOCTYPE html> <html> <body> <h1>My First Web Page</h1> <p>My first paragraph.</p> <button type="button" onclick="myFunction()">Click me!</button> <script> function myFunction() {/* w ww . java 2 s .c o m*/ document.write("Hello World"); } </script> </body> </html>