[thelist] JavaScript: Print Then Close
Christian Heilmann
codepo8 at gmail.com
Thu Jan 12 12:22:59 CST 2006
> It's easy to send a window to the printer with Javascript, and it's just as
> wasy to close a window when a user clicks a "close window" link, but what I
> need is this: from a parent page, a user clicks on a link which opens a new
> window, prints it, and then closes it without any user ineraction other then
> clicking on the one link in the parent window.
> function printpage() {
> window.print();
> this.window.close()
> }
"this" works inside the function. The function does not have a window,
that is why it doesn't work. Get rid of the "this" and just do a
window.close() and you'll be successful in confusing your visitors
with a window popping up quickly, starting a print dialog and closing
(or causing a "this script tries to close a window, do you want to
allow this" warning, depending on the security settings).
--
Chris Heilmann
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/
Binaries: http://www.onlinetools.org/
More information about the thelist
mailing list