Computer >> Computer tutorials >  >> Programming >> Javascript

Can we make print button without JavaScript?


Yes, we can easily make a print button as well as add an image to it.

Example

You can try to run the following code to make a print button as image i.e. whenever a user clicks on the image, the print options are visible −

Live Demo

<!DOCTYPE html>
<html>
   <body>
      <a href="javascript:window.print()"><img src="https://www.tutorialspoint.com/computer_fundamentals/images/inkjet_printer.jpg" height="50" alt="print the page"></a>
      <p>Click above to print the page.<p>
   </body>
</html>