Saturday, January 28, 2012

How to use print() Method in JavaScript

The print() method prints the contents of the current window.
 
Syntax: window.print();
 
JavaScript code:
<script language="javascript" type="text/javascript">

    function printFunction() {
        window.print();
    }

</script>
 
HTML Code:
<input type="button" value="Click to Print!" onclick="this.printFunction();" />

No comments: