By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,638 Members | 1,983 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,638 IT Pros & Developers. It's quick & easy.

print div section from aspx page without popup

P: 1
hi,

i want to print a div section in my aspx page without having to use a popup. Right now I am just calling a javascript function and passing the Div ID to it on the Print button click event.

Expand|Select|Wrap|Line Numbers
  1. function printDiv(divID)
  2.     var tds = document.getElementsByTagName("div"); 
  3.     for(i=0; i<tds.length; i++) 
  4.         tds.item(i).style.display = "none"; 
  5.     document.getElementById(divID).style.display = "block"; 
  6.     window.print(); 
  7.     for(i=0; i<tds.length; i++) 
  8.         tds.item(i).style.display = "block"; 
  9. }
  10.  
The problem is that the print page is coming out to be empty.

Any help is much appreciated. Thank you.
Jul 18 '07 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
Use print stylesheets instead (media="print"). Use these in addition to the screen media style sheets.
Jan 8 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.