Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   JavaScript and Client-Side Browser Scripting (http://www.programmingforums.org/forum23.html)
-   -   Printing lightwindow content (http://www.programmingforums.org/showthread.php?t=14560)

MiKuS Nov 22nd, 2007 9:50 PM

Printing lightwindow content
 
for those who don't know what lightwindow is:
http://www.stickmanlabs.com/lightwindow/

Now, my aim is to load up an image, and have a print button somewhere on the lightwindow, so user can print out a single image.

My first thought was to have lightwindow load up an external html file with a link, which when clicked runs the following javascript:
:

javascript:window.print();

The problem with this is that it prints both the page in the background and the lightwindow.

Now I figured out how i can solve this:
consider index.html as the page running lightwindow
consider image1.html as the page linking the target image with a link, linking to itself.


on index.html, assign the class "lightwindow page-options" to the anchor and have the link pointing to image1.html as per:
:

<a href="coupon1.html" title="Image One" params="lightwindow_width=407,lightwindow_height=330" class="lightwindow page-options"><img src="image1.html"></a>

and then on image1.html consider the following code:

:

<body onload="javascript:window.print();">
<p><img src="image1.png"/></p>
<p><br><a href="image1.html" class="print">Print This Coupon</a></p>
</body>


The above solutions works, but i don't like the way it works - I feel there is an easier way I'm missing.

Does anybody know any other ways I could go about this?


All times are GMT -5. The time now is 3:58 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC