David Dorward said:
And except that it doesn't work when JavaScript isn't available and is
a dead link instead.
And except that it produces a new and unexpected UI control for
something that the typical browser already presents the user with
several ways of doing (File > Print, Ctrl+P, a print button in a
toolbar, etc).
It is pointless. It doesn't allow users to do anything they couldn't
do before, breaks in some cases, and wastes screen space and
bandwidth.
Best way - get rid of it. Otherwise set up a print media stylesheet.
Hi David,
The HTML Police will probably moan but this is how I do it...
<html>
<head>
<title>Test Page</title>
</head>
<script language="JavaScript" type="text/javascript">
<!-- HIDE PRINT BUTTON
function hideprintbutton(){
printon.style.display='none';
printoff.style.display='inline';
}
function showprintbutton(){
printoff.style.display='none';
printon.style.display='inline';
}
// - End of JavaScript - -->
</script>
<body onclick="showprintbutton()">
<span id="printon" style="display: inline"><a href="javascript:
hideprintbutton(); window.print()" title="Click here to PRINT this page"
hidefocus><img src="../images/input/print_button.gif" width="80" height="80"
border="0"></a></span>
<span id="printoff" style="display: none"><img
src="../images/input/print_button_mask.gif" width="80" height="80"
title="Click anywhere to restore the PRINT button"></span>
</body>
</html>
Hope this helps
Andy