Window print() Method - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window print


The print() method prints the contents of the current windowby opening the Print Dialog Box, which lets the user to select preferred printing options.



Return Value:

No return value

The following code shows how to Print the current page:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">Print this page</button>

function myFunction() {/* ww  w.ja v  a2 s  . c om*/


Related Tutorials