Link to home
Start Free TrialLog in
Avatar of Sewingirl2000
Sewingirl2000Flag for United States of America

asked on

How to add a print button on a web page

How do  I add a print button on a web page in Front Page so that my viewers can print the page without using their browser's print function?
Avatar of dopyiii
dopyiii
Flag of United States of America image

Here's what you need:

<html>
<head>
<script type="text/javascript">
function printpage()
{
window.print()
}
</script>
</head>

<body>
<form>
<input type="button" value="Print this page"
onclick="printpage()">
</form>
</body>

</html>
Avatar of Sewingirl2000

ASKER

Can you please tell me how to insert this into the html page in front page on the page that I want to display the button.
THanks
ASKER CERTIFIED SOLUTION
Avatar of dopyiii
dopyiii
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, I will give it a try. I have been away from the computer for a few days. Tonight, I will try this solution for the print function and let you know how it works. I appreciate the help. I'll give it a try right now.
Ok I am sorry, but I don't get it.  Can you try explaining one more time.  Thanks a million.
YES!   IT worked!  THANKS!  This is so wonderful.  Is there a way to print the form without printing the shared borders on the webpage?  THANKS!
You're welcome!  Seems like once you do this sort of thing once or twice it seems so simple :)

I'm not sure about the shared border thing, though.  I believe that's a browser feature and I'm not sure you can turn that off even with scripting.  But, it should only be a Firefox thing - I don't see the border in IE if that helps at all.