Here's an example. Paste the code below into a new text document and save it as Page1.htm. Then browse to the page you saved and click the button. It will open a second window containing the text "I got to page 2!"
<html><head><title>Page 1</title>
<script type="text/javascript">
function showPage2() {
w2 = window.open ("", "_blank", "scrollbars='yes', toolbar='yes', menubar='yes', resizeable='yes', status='yes',
titlebar='yes', location='yes'");
w2doc = w2.document;
w2doc.open("text/html","replace");
var txt="<html><body>I got to page 2!</body></html>";
w2doc.write(txt);
w2doc.title = "Page 2";
w2doc.close();
}
</script>
</head>
<body>
<form action="">
<p>Click the button below to display the text "I got to page 2!" in a separate window.</p>
<input type="button" value="Click for Page 2" onclick="showPage2();">
</form>
</body>
<html>