Add a Print Button to a page

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Please can anyone tell me how to add a print button & icon to a Frontpage
page so when clicked, the user prints the page he is on, without needing to
go to the print button oon the main toolbar.
It may seem a very basic question, sorry!
 
However it fails in Mac/IE5, I believe. As far as I know, this is 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();
}
</script>

Put this in the body of the document -

<a href="javascript:print_page()">Print this</a>
 
Murrar & Kathleen, many thanks to you both.
Mick

Murray said:
However it fails in Mac/IE5, I believe. As far as I know, this is 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();
}
</script>

Put this in the body of the document -

<a href="javascript:print_page()">Print this</a>
 
<!-- Paste this code into the STYLE section of your HTML document
so the button itself will not print -->

<style type="text/css">
<!--
@media print {
input.noPrint { display: none; }
}

-->
</style>

<!-- Paste this code into the BODY section of your HTML document -->

<input class="noPrint" type="button" value="Print This Page"
onclick="window.print()">
</body>


it work good if you put I in the STYLE like this!!!!!1
 
Back
Top