Monday, April 29, 2013

How to Print a part of webpage using Javascript


<div dir="ltr" style="text-align: left;" trbidi="on">
<script type="text/javascript">
function printDiv()
{
   var divToPrint=document.getEelementById('areaToPrint');
  newWin= window.open("");
  newWin.document.write(divToPrint.outerHTML);
  newWin.print();
  newWin.close();
}
</script>

<div id="areaToPrint">
The text you want to print or the content you want to print
</div>
</div>

No comments:

Post a Comment

Please mention your comments.......