call to window.print from input image field - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Image

Description

call to window.print from input image field

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <style id="compiled-css" type="text/css">

#printPage{/*w ww  .  j a va  2 s.  c o m*/
   cursor: pointer;
}


      </style> 
      <script type="text/javascript">
    window.onload=function(){
document.getElementById('printPage').addEventListener('click', function(){
    window.print();
});
    }

      </script> 
   </head> 
   <body> 
      <input type="image" src="http://placekitten.com/50/50" alt="" id="printPage">  
   </body>
</html>

Related Tutorials