Print any web page by javascript button

Hii Friends, in this post we will learn how to print any web page by only simple javascript button. You can print any page write below few some code .

for this, first open your notepad or any text editing application software and write below code after that save this code with (.html) extension. 

now you can print web page to the click print button.

We can print any page by javascript button only write few code.

Code is :

<h1 align="center">Click the print button</h1>
<input type="button" value="Print" onclick="my()" id="btn">
<script>
    function my()
    {
    document.getElementById("btn").style.display="none";
    window.print();
    }

</script>

OUTPUT

Click the print button

Comments