Forum Moderators: phranque

Message Too Old, No Replies

Trying to add a "Print this" function and "Email this" function

         

ikez78

4:45 pm on Jul 14, 2007 (gmt 0)

10+ Year Member



Hey guys,
Been driving myself absolutely insane the past few weeks now reading multiple walkthroughs and sources of code for adding a "Print this" and an "Email this" button/link for readers of my site to print or email a post/story on my site. Getting pretty discouraged because NOTHING is working.

Can someone recommend a simple walkthrough and/or piece of code where I can do this and have it link to an email and a print gif I have already made?

Thanks in advance

rocknbil

8:34 pm on Jul 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome aboard Ike, have you tried this?

<script type="text/javascript">
document.write('<a href="#" onClick="window.print(); return false;"><img src="your-print-image.gif"><\/a>');
</script>

By surrounding it in the script declaration, it will only appear if Javascript is enabled. You can simply do

<a href="#" onClick="window.print(); return false;"><img src="yourimage.gif"></a>

But it will always appear, and won't work if Javascript is disabled, which may confuse the user.

The email a page I've just never had a need to implement, but I know there are many "email this page" Javascripts out there, keep looking.