Entry
How can I stop a body ONBLUR="window.close();" affecting onClick="javascript:window.print()
Sep 11th, 2002 02:55
Jean-Bernard Valentaten, Nick Hearn,
I'd use a flag indicating whether the window has really lost it's focus
or will get it back soon.
at the beginning of the document you write this inside a script-block:
var isPrinting = false;
in the body-tag you write:
onBlur="if (!isPrinting) window.close();"
onFocus="isPrinting = false;"
and finally in your link (or where ever):
onClick="isPrinting = true; window.print();"
HTH,
Jean