Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

JavaScript: Print ONLY the Table

Featured Replies

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>



 

I didn't try that yet, but thanks for your contribution!

  • Author

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 laugh.gif

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.