Jump to content

Printing all the data in a scroll table

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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...