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

adding a print command button on a web page

Status
Not open for further replies.

rwb331

Technical User
Feb 7, 2000
1
US
Can someone please tell me how to set up a button on a web page to print the page the button is on.
 
Add this between your head tags:
Code:
<script language=&quot;Javascript1.2&quot;>
<!--
// ***********************************************
// AUTHOR: [URL unfurl="true"]WWW.CGISCRIPT.NET,[/URL] LLC
// URL: [URL unfurl="true"]http://www.cgiscript.net[/URL]
// Use the script, just leave this message intact.
// Download your FREE CGI/Perl Scripts today!
// ( [URL unfurl="true"]http://www.cgiscript.net/scripts.htm[/URL] )
// ***********************************************

function printWindow(){
browserVersion = parseInt(navigator.appVersion)
if (browserVersion >= 4) window.print()
}

// -->
</script>

Add this to your body:
Code:
<a href=&quot;javascript:printWindow()&quot;>Print This Page</a>

Can be found here:

Mike Barone
FREE CGI/Perl Scripts & JavaScript Generators
Ace PopUp Generator Software - Totally FREE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top