Jump to content

Printing all the data in a scroll table


maja88g

Recommended Posts

Hi all, I am trying to print ALL the content of a scrolling table without usingiframes, opening a new window or hiding all the other elements on my screen. It it possible to send a command that will only print a specific element based onthe id without having to change screen displays? <!--Html table code I need to print, table is dynamically populated from javascript so the length constantly varies.-->

<!--some code--><div id="printme"><table border="1" width="598" id="ccblanktableheader">	   <tr bgcolor="#E4E5E5">		<th width="15%"><font face="tahoma" color="rgb(6,79,168)">Date</font></th>		<th width="20%"><font face="tahoma" color="rgb(6,79,168)">Customer No.</font></th>		<th width="23%"><font face="tahoma" color="rgb(6,79,168)">Complaint No.</font></th>		<th width="12%"><font face="tahoma" color="rgb(6,79,168)">Status</font></th>		<th width="23%"><font face="tahoma" color="rgb(6,79,168)">Type</font></th>		<th width="7%"><font face="tahoma" color="rgb(6,79,168)">View</font></th>	   </tr>	  </table>	  <div style="font-size: 12px; face:tahoma; height: 315px; overflow:auto;border:1 ">	   <table border="1" width="593" id="ccblanktable" align="center">		<tr bgcolor="#E4E5E5">		 <th width="15%"></th>		 <th width="20%"></th>		 <th width="23%"></th>		 <th width="12%"></th>		 <th width="23%"></th>		 <th width="7%"></th>		</tr>	   </table>	  </div></div><!--more code-->

I have tried multiple javascripts but none work without either opening a new window or changing displays.This was my most recent test.

 var content_innerhtml = document.getElementById("ccblanktable").innerHTML;  var document_print=window.open("","",display_setting);  //Opens new windowdocument_print.document.open();  document_print.document.write('<html><head><title>print using javascript</title></head>');  document_print.document.write('<body style="font-family:verdana; font-size:12px;" onLoad="self.print();self.close();" >');  document_print.document.write(content_innerhtml);  document_print.document.write('</body></html>');  //does not show as a table, rather a a single rowdocument_print.print();  document_print.document.close();  

Any ideas how I can do this?Thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...