Leb i Sol Posted March 28, 2003 Posted March 28, 2003 hello People! I found this script VERY useful when one desires to print ony a specific table on the page. Here is the script: <html> <head> <title>PRINT</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <table width="711" height="162" border="1" cellpadding="0" cellspacing="0" bordercolor="#999999" id="TABLE_NAME_OF_TABLE_THAT_YOU_WANT_TO_PRINT"> <tr> <td align="center">OUTPUT HERE</td> </tr> </table> <table width="712" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000" id="PRINT"> <tr> <td height="30" align="center"><a href="#" onClick="w=window.open('','newwin'); w.document.write('<bo'+'dy onLoad='window.print()'>'+ '<table>'+document.getElementById('TABLE_NAME_OF_TABLE_THAT_YOU_WANT_TO_PRINT').outerHTML+'</table></bo'+'dy>'); w.document.close(); return false"> <font size="4" face="Verdana, Arial, Helvetica, sans-serif">.: PRINT .</font></a> </td> </tr> </table> </body> </html>
Anatoli Posted March 28, 2003 Posted March 28, 2003 I didn't try that yet, but thanks for your contribution!
Leb i Sol Posted March 29, 2003 Author Posted March 29, 2003 No problem...this was a script I found the then edited to fit the needs of my printing.I thought some one might use it...this is what this forum is all about,right!? side note: If you use some JS inside the 'TABLE_NAME_OF_TABLE_THAT_YOU_WANT_TO_PRINT'table then edit/remove bold parts of the code.....the bold (<table></table>)part of the code: ------------ <table>'+document.getElementById('TABLE_NAME_OF_TABLE_THAT_YOU_WANT_TO_PRINT').outerHTML+'</table> ----------- to strip the 'TABLE_NAME_OF_TABLE_THAT_YOU_WANT_TO_PRINT'table from the borders and html decorations and such use .innerHTML in the code above! happy printing
Recommended Posts
This topic is 7902 days old. Please don't post here. Open a new topic instead.
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 accountSign in
Already have an account? Sign in here.
Sign In Now