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

JS Print Button

Status
Not open for further replies.

sailruner

Technical User
Apr 14, 2002
60
US
I now little to none on JS and I have a web page that I would like to add a print button too. Which acts as tek-tip does, "printer-friendly page"
thank you
 
<input type=button value=&quot;Print&quot; onClick=&quot;window.print()&quot;>

or

<a href=&quot;#&quot; onCLick=&quot;window.print()&quot;>Print Page</a>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
mwolf00
I may be missing something
<input type=button value=&quot;Print&quot; onClick=&quot;window.print()&quot;>
This no problem I get.

<a href=&quot;#&quot; onCLick=&quot;window.print()&quot;>Print Page</a>

Can I set a href=&quot;#&quot;
as
onClick=&quot;the section I want to print&quot; ?
 
You can say
<a href=&quot;javascript: window.print()&quot;>Print Page</a>

But you are not able to print just a selection unless you use CSS to hide eveything else for printing. The user can print just a selection using their print dialog box, but you don't have control over that

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top