Solved

How to add a print button on a web page

Posted on 2006-07-17
7
1,700 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. 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 : Open Page or Post…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…

708 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

9 Experts available now in Live!

Get 1:1 Help Now