Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Print a particular area of a page using javascript
12-13-2011, 04:20 AM
Post: #1
Question Print a particular area of a page using javascript
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,sta­​tus=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
Find all posts by this user
Add Thank You Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies Views: Last Post
Thumbs Up how to check value is number or not using Javascript rajasri 0 148 12-13-2011 04:31 AM
Last Post: rajasri
Lightbulb linking two or more pages from radio button using javascript rajasri 0 167 12-13-2011 04:17 AM
Last Post: rajasri

Forum Jump:


User(s) browsing this thread: 1 Guest(s)


WE will share important jobs and updates on facebook so like us to get updates