• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1766
  • Last Modified:

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?
0
Sewingirl2000
Asked:
Sewingirl2000
  • 4
  • 3
1 Solution
 
dopyiiiCommented:
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>
0
 
Sewingirl2000Author Commented:
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
0
 
dopyiiiCommented:
Well, you actually have a couple of ways.  In FrontPage, you can insert a form and then a button, but I find it just as easy to add the code manually because you'd have to add the script stuff by hand anyway.

Just put your cursor where you'd like the button to be and then click the HTML tab on the bottom of the viewer to switch to the HTML code.  The cursor should be in the code where it was on the page (if not, try selecting something right next to where you want the button - this will just help to get you oriented).

Once you're there, paste the <form>...</form> tags (and what's in between).  This will put the button on the form.  As you can see, the <script.... /script> stuff goes in the <head></head> tags in top of the document.

You might have to play with it a bit.  If you know how to insert a form using FrontPage, you might try inserting a form with the button using the GUI, then going into the code and changing the onclick attribute for the button's input tag.

Does that help?
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Sewingirl2000Author Commented:
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.
0
 
Sewingirl2000Author Commented:
Ok I am sorry, but I don't get it.  Can you try explaining one more time.  Thanks a million.
0
 
Sewingirl2000Author Commented:
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!
0
 
dopyiiiCommented:
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.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now