Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Pages

Status
Not open for further replies.

eor0303

Technical User
Jul 29, 2003
10
GB
Can anyone tell me how to specify a section to print on a website? I have a page with two sections and would like to have two buttons saying 'print here for XYZ' and 'print here for ABC'

Many thanks
Eileen
 
"I have a page with two sections "
- sections made out of what?
two tables?two layers?
I can give u a script to print a particular table on the page.....
all the best!

> need more info?
:: don't click HERE ::
 
Sorry, yes the information is contained in two tables.

Would really appreciate help if you can give it. Can you make it as 'dumbed down' as you possibly can as I'm a very new newbie :)

Thank you
 
here it is:
Code:
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;>
<html>
<head>
<title>Print only One Table</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body>
<table width=&quot;442&quot; height=&quot;101&quot; border=&quot;0&quot; align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; bgcolor=&quot;#FF6600&quot; id=&quot;TOP_TABLE&quot;>
  <tr>
    <td align=&quot;center&quot;>This (TOP_TABLE) table will be printed. <br>
      Table must be named as u will refer to it in JS below!</td>
  </tr>
</table>
<table width=&quot;214&quot; height=&quot;22&quot; border=&quot;0&quot; align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; bgcolor=&quot;#CCCCCC&quot; id=&quot;NAVTABLE&quot;>
  <tr> 
    <td align=&quot;center&quot;> <a href=&quot;#&quot; onClick=&quot;w=window.open('','newwin'); 
				w.document.write('<bo'+'dy onLoad=\'window.print()\'>'+ document.getElementById('TOP_TABLE').outerHTML +'</bo'+'dy>'); 
				w.document.close(); return false;&quot;>PRINT TABLE ABOVE </a> </td>
  </tr>
</table>
</body>
</html>


All the best!

> need more info?
:: don't click HERE ::
 
Nice little bit of code there lebisol, I took a copy for future ref

Cheech

[Peace][Pipe]
If you don't stand up for something, you'll fall down. Toke it Easy.
Howard Marks.
 
and there is another method using IFRAMES ofcourse:

<iframe src=&quot;html_file&quot; name=&quot;frm1&quot;></iframe>
<br><a href=&quot;javascript:document.frm1.print()&quot;>Print Here</a>

Known is handfull, Unknown is worldfull
 
yeah its pretty nice...the only thing about it is &quot;decorating&quot; the table and extending the w.document.write CAN be a pain.....other than that it works pretty slick!
;-)
All the best!

> need more info?
:: don't click HERE ::
 
Wow, lebisol, thank you! Worked a treat - exactly what I needed.

Best regards,
Eileen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top