Definition:
window.print() Method
Using window.print() to print a document
The JavaScript syntax used to simulate the print button
currently only works in all modern browsers, so it can be a valid substitute
inside a browser window where the toolbar is disabled.
Syntax used to print a document:
window.print()
Example:
Example:
<input type="button" value="Print this page" onClick="window.print()">
OR
Another way to accomplish the exact same task as above is to use a
"JavaScript url". A JavaScript url is a special kind of url that executes a
command, instead of loading the specified url.
<a href="javascript:window.print()"><img src="../images/print.gif"></a>
Output:
You can see print dialogue box.
No comments:
Post a Comment