Issue
Here is my page: http://budclarychevy.com/custom/parts-specials-test
My aim is to have the images clickable and open in a new window with a prompt to print. The closest method I can find is the window.print()
function in JavaScript but that just prints the entire page. I'd like each image to open on a printable page by itself. Is this possible with JavaScript? If there's another method, what is it?
Solution
you can simply add an onclick event with some javascript.
<img src="http://budclarychevy.com/path/to/my/image.png"
width="660" height="225" alt="GM Oil Filters"
onclick="newWindow = window.open('http://budclarychevy.com/path/to/img.png');
newWindow.print();">
As you can see, on a click a new window is opened with the url of the picture. As you have a reference to the new window object, you can call the 'print()' function on it.
Cheers Laidback
Answered By - laidback
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.