Using document.write() on the Current Window
<HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript"> function reWrite() { var newContent = "<HTML><HEAD><TITLE>A New Doc</TITLE></HEAD>" newContent += "<BODY><H1>This document is brand new.</H1>" newContent += "Click the Back button to see original document." newContent += "</BODY></HTML>"; document.write(newContent); document.close(); } </SCRIPT> </HEAD> <BODY> <FORM> <INPUT TYPE="button" VALUE="Replace Content" onClick="reWrite()"> </FORM> </BODY> </HTML>