Javascript Print specified div
1 2 3 4 5 6 7 8 | <span style="color: #33cccc;"> </span>printDiv() { Â Â <span style="color: #33cccc;"> </span> =Â document.getElementById('toprint'); Â Â newWin=Â window.open(""); Â Â newWin.document.write(divToPrint.innerHTML); Â Â newWin.print(); Â Â newWin.close(); } |
or use this code in the css
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <head>   <style type="text/css">   #printable { display: none; }   @media print   {     #non-printable { display: none; }     #printable { display: block; }   }   </style> </head> <body>   <div id="non-printable">     Your normal page contents   </div>   <div id="printable">     Printer version   </div> </body> |



