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

how do I print??? 3

Status
Not open for further replies.

GBONGIOVANO

Programmer
Jan 17, 2003
16
US
Sounds stupid but how does one create a link so when the user clicks it, it sends the page to the printer or the print menu.
Thanks,
G
 
<a href=&quot;#&quot; onclick=&quot;window.print()&quot;>print me</a> [Hammer]
Nike Failed Slogans -- &quot;Just Don't Do It!&quot;
 
Your a programmer and didnt know that? Sounds fishy . . lol, jk. Anyway to add to the answer let me remind you that you can discard certain things from being printed as well for ex:

<style media=&quot;print&quot; type=&quot;text/css&quot;>
.noprint {display:none;}
textarea {border:0;}
</style>
<style>
textarea
{
overflow:auto;
}
</style>

<input type=&quot;button&quot; value=&quot;Print&quot; onClick=&quot;window.print()&quot; class=&quot;noprint&quot;>

Hope that helps

Code One
 
CodeOne,
I wonder if you could help me also, I do not want any of my hyperlinks to print out

Regards

Paul
 
<style media=&quot;print&quot; type=&quot;text/css&quot;>
A {display:none;}
</style>

<style type=&quot;text/css&quot;>
A {display:inline;}
</style>
 
Mr3putt
thanks for your quick response, but another silly question, where exactly would i place this code on my page

Regards

Paul
 
<html>
<head>
[red]...put the &quot;style&quot; code here...[/red]
</head>
<body>
all your normal stuff in here...
</body>
</html>
 
I must be doing something wrong as I have tried that but the links are still printing, this is where i have put the code

<html>
<head>
<style media=&quot;print&quot; type=&quot;text/css&quot;>
A {display:none;}
</style>

<style type=&quot;text/css&quot;>
A {display:inline;}
</style>
<title>Corrugator Cleaning Schedules</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body>

Regards

Paul
 
The styles for screen and print may also vary with your web browser. Some older browsers do not support this.

I would recommend explicitly stating screen for the second style...

<style media=&quot;print&quot; type=&quot;text/css&quot;>
A {display:none;}
</style>

<style media=&quot;screen&quot; type=&quot;text/css&quot;>
A {display:inline;}
</style>


- - picklefish - -
 
Hello,
sorry to take so long I just got this message at 11:30p.m. tonight and it seems Im not to late. If I were you I would try this:
====================================================
<html>
<head>
<title>A genius made this</title>
</head>
<body>
<style media=&quot;print&quot; type=&quot;text/css&quot;>
.noprint {display:none;}
textarea {border:0;}
</style>
<style>
textarea
{
overflow:auto;
}
</style>
<table border=0 class=&quot;noprint&quot;><!--everything inside this table will NOT print-->
<td><a href=&quot;blah.html&quot; onClick=&quot;window.print()&quot; class=&quot;noprint&quot;>Blah</a></td>
</table>
</body>
</html>

=====================================================

Hope this helps,

Code One
 
sorry Im tired I put blah.html where it would actually say &quot;#&quot;, heres the new and improved code disregard the above:
====================================================
<html>
<head>
<title>someone who thought he was a genius made this</title>
</head>
<body>
<style media=&quot;print&quot; type=&quot;text/css&quot;>
.noprint {display:none;}
textarea {border:0;}
</style>
<style>
textarea
{
overflow:auto;
}
</style>
<table border=0 class=&quot;noprint&quot;><!--everything inside this table will NOT print-->
<td><a href=&quot;#&quot; onClick=&quot;window.print()&quot; class=&quot;noprint&quot;>Blah</a></td>
</table>
</body>
</html>

=====================================================


Good night

CO
 
CodeOne, Mr3putt and jimoblak thanks for all your help from the info supplied by you all I now have the print working as i would like. stars for you all

Regards

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top