I have some small images and each has a "print larger image" link.
For example:
<img src="thumb.jpg">
<a href="#">Print Larger Image</a>
When the user clicks the "print larger image" link, my goal is to trigger the printing of "big.jpg".
How can this be done?
EDIT: ANTHONY HAD THE RIGHT SOLUTION FOR ME. I MODIFIED HIS CODE A BIT TO GET IT WORKING. HERE'S THE FULL, WORKING CODE
<style>
@media screen {
.printimage {
display: none;
}
}
@media print {
body * {
display: none;
}
.printimage {
display: block;
}
}
</style>
<a id="bigimage" href="#">Print Big Image</a>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#bigimage").click(function() {
$("body").append("<img src='http://sstatic.net/so/img/logo.png' class='printimage' >");
window.print();
});
});
</script>