Change the HTML content of the current document:
document.body.innerHTML = "Some new HTML content";
Click the button to change the HTML content of the document.
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <script> function myFunction() {/*from ww w. j av a2 s .c o m*/ document.body.innerHTML = "Some new HTML content"; } </script> </body> </html>