JavaScript – Print Page

If you want to take print of current page, JavaScript have a function called print(). Print function takes print of window which is opened in browser. When you fire this event, a popup window will open for printing option.

 

Print() can take particular frame print

But window menu file –> print only take full window print.

 

This event can fire with any event attribute of html. These events can be onClick, ondblclick

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

If you take automatic print of page

<body>
<script>
  window.print();
</script>
</body>

Demo

 
  
 

Bookmark  

 

Leave a Reply

Security Code:

 

  Random Post