JS Coding Questions Logo
JS Coding Questions
#213💼 Interview💻 Code

How do you print the contents of web page

Advertisement

728x90

The window object provides a print() method which is used to print the contents of the current window. It opens a Print dialog box which lets you choose between various printing options. Let's see the usage of print method in an example,

html
1<input type="button" value="Print" onclick="window.print()" />

Note: In most browsers, it will block while the print dialog is open.

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 43

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
213of476