How can I put a shortcut on a web page to print the page?

T

Tom Willett

Print Button (Courtesy of MVP Murray):

Put this in the head of the document -

<script type="text/javascript">
function print_page(where){
var is_mac=(navigator.platform.indexOf("ac") != -1);
(document.all && is_mac)?
alert("Select \"Print\" from the menu") : where? where.window.print() :
window.print();
}
</script>

Put this in the body of the document -
<a href="javascript:print_page()">Print this</a>
---
--
===
Tom Willett
Microsoft MVP - FrontPage
---
FrontPage Support:
http://www.frontpagemvps.com/
===
| I'm using FrontPage 2002 with our web site hosted on a Windows platform.
| --
| Maureen
 
G

Guest

Thank you so much for your help. I have a couple more questions though.

When I cut and pasted the text into the HTML, I had to put <s and >s back
in, and it turned blue like the rest of the code before it.

The section starting with "function print" and ending with "}" is red
instead of blue. Is there something else I need to put in there, or is the
red OK?

It works, so maybe the red is OK.

<script type="text/javascript">
function print_page(where){var is_mac=(navigator.platform.indexOf("ac") !=
-1);
(document.all && is_mac)?
alert("Select \"Print\" from the menu") : where? where.window.print() :
window.print();
}
</script>

Also, is there a way to make that print page command print in landscape
format? I obviously have a lot to learn about creating web pages 'cause when
they print portrait, it causes some text to go to a second line even though
it appears the way it should on the web site.

Thank you again for your help. I'm learning - slowly, but surely!
 
S

Stefan B Rusynko

1) You paste it in code/html view in the head section
2) No you can not control the users print layout (to landscape)

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


| Thank you so much for your help. I have a couple more questions though.
|
| When I cut and pasted the text into the HTML, I had to put <s and >s back
| in, and it turned blue like the rest of the code before it.
|
| The section starting with "function print" and ending with "}" is red
| instead of blue. Is there something else I need to put in there, or is the
| red OK?
|
| It works, so maybe the red is OK.
|
| <script type="text/javascript">
| function print_page(where){var is_mac=(navigator.platform.indexOf("ac") !=
| -1);
| (document.all && is_mac)?
| alert("Select \"Print\" from the menu") : where? where.window.print() :
| window.print();
| }
| </script>
|
| Also, is there a way to make that print page command print in landscape
| format? I obviously have a lot to learn about creating web pages 'cause when
| they print portrait, it causes some text to go to a second line even though
| it appears the way it should on the web site.
|
| Thank you again for your help. I'm learning - slowly, but surely!
| --
| Maureen
|
|
| "Tom Willett" wrote:
|
| > Print Button (Courtesy of MVP Murray):
| >
| > Put this in the head of the document -
| >
| > <script type="text/javascript">
| > function print_page(where){
| > var is_mac=(navigator.platform.indexOf("ac") != -1);
| > (document.all && is_mac)?
| > alert("Select \"Print\" from the menu") : where? where.window.print() :
| > window.print();
| > }
| > </script>
| >
| > Put this in the body of the document -
| > <a href="javascript:print_page()">Print this</a>
| > ---
| > --
| > ===
| > Tom Willett
| > Microsoft MVP - FrontPage
| > ---
| > FrontPage Support:
| > http://www.frontpagemvps.com/
| > ===
| > | > | I'm using FrontPage 2002 with our web site hosted on a Windows platform.
| > | --
| > | Maureen
| >
| >
| >
 
G

Guest

None of those things work. In fact, when I tried them they only moved stuff
around on my site that wasn't supposed to be moved. Is there just a simple
walkthrough for doing this? Is there a specific place to paste this code?
Why can't explanations just be in standard English for this stuff?

Mark
 
G

Guest

Wow, thanks. Now I just need an email one. Been going nuts for weeks trying
to figure this out.

Mark
 
G

Guest

Ok, just tried it on my site and nothing. Would this go in the body of a
post/story on a site used to blog or in the index of the main site?

Mark
 
G

Guest

Yes, thanks. The site is www.regimeofterror.com.
I am trying to use FrontPage or anything to add a "Print this" and "Email
This" function so my readers can do both. I'd like to ideally add it to the
top right of each story and am willing to do this manually each time or build
it into the code for the entire site if need be.

Your help is greatly appreciated.

Thanks,
Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top