How to use Window Object Print in JavaScript

In this article I am going to explain about Window object Print() method in JavaScript.
  • 2438

JavaScript Window Object Print() Method

JavaScript Print method use for print the page content. Print method will print the content of current open window. For print to content a printer must be attach with your computer.

Syntax

 

Window.print()

Example

In this example when you click on print button then a print window will be open.

<html>

<head>

<script type="text/javascript">

    function myfun() {

        window.print();

    }

</script>

</head>

<body>

 

<button onclick="myfun()">print</button>

</body>

</html>

 

Output


print.gif

 

You may also want to read these related articles: here
 
Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.