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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing data in an html form

Status
Not open for further replies.

sweetleaf

Programmer
Jan 16, 2001
439
CA
Hi there!

I have an html page with a table which i want users to have the ability to print at the click of a button.
Is this at all possible?

Thanks,
Any help is greatly appreciated!
 
That's no answer. I believe that what sweetleaf wants is a way to print JUST the table from the html page. Even if s/he wants to print the whole page, what's wrong with
Code:
<input type=button value=&quot;print&quot; onClick=&quot;window.print()&quot;>
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Oh yes, it works. I've used it before. The one thing I don't like is that the button will also print, unless you use some javascript to create an onBeforePrint function to hide the button before printing, and I think that's an IE-only solution. The other options are to use a link to print, like this:
Code:
<a href=&quot;javascript:window.print()&quot;>Click here to print this page</a>
or to open up a new (popup) window, write the information to that window using windowname.document.writeln(&quot;...&quot;), and then print that window using windowname.print().
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Couldnt you just hide it by putting the button in a span,
and then setting innerHTMl = ''; ??? [bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
 
BobbaFet: that might work too. I've never bothered with using innerHTML yet. Would that work in both NS and IE?
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top