Ok something better but even more wierd ...
The javascript is in my main window. In there I create the new window as
follows:
printWin=open('','printWindow','resizable=no,width =690,height=600,menuba
r=yes,status=no,scrollbars=yes');
This window's name is clearly printWindow. Anyways, further down I have
this code:
var c = printWin.document.createElement("center");
var foo = printWin.document.createElement("form");
var btnPrint = printWin.document.createElement( 'button' );
btnPrint.setAttribute("name", "p");
btnPrint.setAttribute("value", "Print");
btnPrint.setAttribute("onclick", "executePrint()");
btnPrint.onclick=function(){printWin.print();};
var btnClose = printWin.document.createElement( 'button' );
btnClose.setAttribute("name", "c");
btnClose.setAttribute("value", "Close");
btnClose.onclick=function(){printWin.close();};
foo.appendChild( btnPrint );
foo.appendChild( btnClose );
c.appendChild( foo );
printWin.document.body.insertBefore
(c,printWin.document.body.firstChild);
This creates two buttons on top of my new (print) window. The wierd
thing is that close button works fine! It closes the print window that
has been created (popped up). However, the print button has no effect
whatsoever!
I tried window.print() but that causes the original main window to get
printed. And I also tried printWindow.print() for which I get this dumb
error saying printWindow is undefined.
Also, since these buttons are dynamically generated they dont appear in
the view source of my pop up, but I doubt thats got anything to do with
it.
So how do I get the print screen to print properly using this button?
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!