how do you create a print page command

D

Dean Paulson

I would like the front page page to print when someone clicks on the print
page command button - how do i do that?
 
K

Kevin Spencer

JavaScript. Example:

<input type="button" name="B1" value="Print" onclick="window.print();">

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
 
M

Murray

That fails on IE5/Mac. And it will fail to appear in any modern browser
unless it is enclosed in <form> tags.

I usually do this -

<button value="Print this" onClick="alert('Please use File | Print on your
browser's menu')>Print this</button>

But seriously, here's about the best you can do -

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();
}

function writeOutPrintLink(){
document.getElementById('printLink').innerHTML = '<a
href="javascript:print_page();">Print this</a>'

}

</script>

Adjust the body tag of the document as follows -

<body ... onload="writeOutPrintLink();"> (where the ellipsis indicates
already existing attributes, if any)
<span id="printLink"></span>

That way, the link only shows up if you have javascript enabled.
 
T

Tom Pepper Willett

Print This Page, Courtesy of 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 "Pepper" Willett
Microsoft MVP - FrontPage
---
FrontPage Support:
http://www.frontpagemvps.com/

About FrontPage 2003:
http://office.microsoft.com/home/office.aspx?assetid=FX01085802
===
| What's wrong with the Print icon on the toolbar or the Print on the File
| dropdown?
|
| Dean Paulson wrote:
| > I would like the front page page to print when someone clicks on the
print
| > page command button - how do i do that?
 

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