Javascript print
Javascript provides the ability to send the content of a webpage to be printed.
This lesson focuses on:
- The print() function
The print() function
The print() function can be used to send the content of a webpage to be printed. This function will not actually print the page, but will achieve the same effect as going to the "File" menu and choosing the print option -- it will bring up the print options window in which you choose how to print a document.
Example:
<input type="button" onclick="window.print()" value="Print this page" />
Output:
Click on the button to bring up the print options window in which you can choose how to print a document.




