DHTML Methods
Prints the document associated with the window.
window.print ( )
No return value.
Calling the print method has the same effect as choosing Print from the Microsoft® Internet Explorer® File menu. The method, exposed off the window object, presents the print dialog for the user to OK or cancel. Pages cannot be printed without user acceptance from this dialog.
The onbeforeprint and onafterprint events are fired immediately before and after the document associated with the window is printed. These two events are particularly useful when not all the information on the page is visible at all times. The onbeforeprint event gives the Web author an opportunity to modify the document to make all the information on the page visible for printing purposes. The onafterprint event provides a means to revert the document back to its original state.
This example lets an author call the window.print ( )
method which prompts the user to print the current page.
<input type=button value="Print me"
onclick="window.print ( ) ">
window