Guys today we are going to know how to print specific portion of a page using javascript.
See the example below first write the javascript in head section and cover the places you want to print with in div id="print" and finally call the javascript within the page
function print1(strid)
{
if(confirm("Do you want to print?"))
{
var values = document.getElementById(strid);
var printing =
window.open('','','left=0,top=0,width=550,height=400,toolbar=0,scrollbars=0,status=0');
printing.document.write(values.innerHTML);
printing.document.close();
printing.focus();
printing.print();
printing.close();
}
}
With in body tag
Quote:<div id="print">
Any values table you want to print
</div>
<input type="image" src="PrintBill.jpg" name="printbutton" value="PrintBill" onclick="return print1('print')"/>
Any doubt comment us.
happy coding