Javascript Print Command

K

Kosarko

Hello,

I know this should be kind of easy, but I am very unfamiliar with
Javascript.

What I am looking to do is have an image (coupon) that when clicked on,
it either prompts for printing only that image, or pops up a window and
automatically after loading the image in the new window, brings up the
print dialog box. What would you suggest is the best way to do this?

Thank you in advance,

Brian
 
V

VK

Hello,
Hi,

What I am looking to do is have an image (coupon) that when clicked on,
it either prompts for printing only that image,

Not doable: print() method applies to the entire window or to the
current frame (if frameset), and it always shows print dialog first (a
security mesure).
or pops up a window and
automatically after loading the image in the new window, brings up the
print dialog box. What would you suggest is the best way to do this?

Taking into account what I said before, the only visible option is to
make each picture linked to popup function, and each popup window
having <body onload="window.print()">

Also note that many visitors will probably have popup blockers
activated.

If you want to run a discount coupons business, I would suggest to use
hidden iframe to rewrite the content on each image click and
myIFrame.print() then. Very old but still the best way IMHO.
 
K

Kosarko

Thank you very much, that is exactly what I was looking for. I only
have a need for like one or two coupons on the site, so it is a basic
operation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top