In this article I am going to explain how to print the content of the web page. There are times when we want to print the content of the webpage on the paper. We would like to give a print command just on clicking a button. Java Script also provides this with the help of window.print() function.
The Java Script window.print() will print all the content of the current web page when that function is executed. This function will be called on the button click event which I will show you in the example given below.
<input id="btnPrint" type="button" value="Print" onclick="window.print()" />
We have called window.print() function on the button click. As soon as we
will click on the button Print dialog will open. If printer is not installed then
we have to install it.
From this tutorial we came to know how Java Script provides us to print
web page content through
printer on a paper.