Solved

How to add a print button on a web page

Posted on 2006-07-17
7
1,708 Views
Last Modified: 2013-12-24
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
Comment
Question by:Sewingirl2000
  • 4
  • 3
7 Comments
 
LVL 20

Expert Comment

by:dopyiii
ID: 17130539
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
 

Author Comment

by:Sewingirl2000
ID: 17131693
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
 
LVL 20

Accepted Solution

by:
dopyiii earned 250 total points
ID: 17132045
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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:Sewingirl2000
ID: 17165356
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
 

Author Comment

by:Sewingirl2000
ID: 17165396
Ok I am sorry, but I don't get it.  Can you try explaining one more time.  Thanks a million.
0
 

Author Comment

by:Sewingirl2000
ID: 17165429
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
 
LVL 20

Expert Comment

by:dopyiii
ID: 17167191
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
replace tables with divs, using templates(bootstrap) 9 308
Problem to event 1 759
Intranet building Software 8 98
I starting with php 12 115
Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The purpose of this video is to demonstrate how to properly insert a Vimeo Video into a WordPress site or Blog. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now