Entry
Why doesn't window.print() work in a child window which is opened using the window.open method
Mar 6th, 2004 23:23
Gerry Baldwin, Guest,
<HTML>
<HEAD>
<TITLE>Print Child Window</TITLE>
<SCRIPT>
function printChildWindow() {
var newWindow = window.open
("newWindow.html", "newWindow", "height=200,width=300");
newWindow.document.write('<HTML><HEAD><TITLE>Print
Daughter</TITLE></HEAD><BODY><CENTER><BR><BR>This is some
data.<BR><BR><BR><INPUT TYPE="button" NAME="print" VALUE="Click to
Print" ONCLICK="window.print()"></CENTER></BODY></HTML>');
newWindow.document.close(); //This is the key!!!
}
</SCRIPT>
</HEAD>
<BODY>
<CENTER>
<BR><BR><BR>
<INPUT TYPE="button" VALUE="Click to Create New Window"
ONCLICK="printChildWindow();">
<CENTER>
</BODY>
</HTML>