/* JavaScript Bible, Fourth Edition by Danny Goodman
John Wiley & Sons CopyRight 2001 */
<HTML> <HEAD> <TITLE>New Window</TITLE> <SCRIPT LANGUAGE="JavaScript"> var newWindow function go_to_demo() { if (!newWindow || newWindow.closed) { newWindow = window.open("","","status,height=200,width=300") if (!newWindow.opener) { newWindow.opener = window } // force small delay for IE to catch up setTimeout("writeToWindow()", 50) } else { // window's already open; bring to front newWindow.focus() } } function writeToWindow() { // assemble content for new window var newContent = "<HTML><HEAD><TITLE>One Sub Window</TITLE></HEAD>" newContent += "<BODY><H1>This window is brand new.</H1>" newContent += "</BODY></HTML>" // write HTML to new window document newWindow.document.write(newContent) newWindow.document.close() // close layout stream }