Print a Web Page Using JavaScript
by Sanju[ Edit ] 2010-02-02 15:21:07
Print a Web Page Using JavaScript
To print your webpage using javascript use
window.print(). It will print your webpage.
Here's the code:
<a href="javascript:window.print()">Print This Page</a>
Result:
Print This Page
You can set it to print off of an image:
<a href="javascript:window.print()">
<IMG SRC="print.gif" border="0"</a>
You can set it to trigger off a button:
<form>
<inout type="button" onClick="window.print()">
</form>