Feedback on: irt.org FAQ Knowledge Base Q1403
Comments:
It doesn't work. When I push the print button. The print menu will appear. I print the document but the button still appears on the printed document ?????
Can someone help me ?
Worth:
Worth reading
Length:
Just right
Technical:
Just right
Comments:
Create a button which resides in a division, which is hidden upon clicking then unhidden after the print operation, thus:
<html>
<head>
<script language="javascript">
</head>
<body>
Click button to print this screen.
<div id="printbutton">
<button onclick="PrintWithoutButton('printbutton')">Print Screen</button>
</div>
</body>
</html>
Worth:
Worth reading
Technical:
Too technical
Comments:
Another method...
<SCRIPT LANGUAGE=javascript>
</SCRIPT>
<FORM name="frmButtons" action="">
<INPUT type="button" name="btnAddEntry" value="Add a new task">
<INPUT type="button" name="btnBack" value="Back">
<INPUT type="button" name="btnPrint" onClick="Javascript: doPrint()" value="Print">
</FORM>
Worth:
Worth reading
Technical:
Too technical
Comments:
Another method...
<SCRIPT LANGUAGE=javascript>
function doPrint()
{
document.frmButtons.btnAddEntry.style.visibility = 'hidden'
document.frmButtons.btnBack.style.visibility = 'hidden'
document.frmButtons.btnPrint.style.visibility = 'hidden'
window.print()
document.frmButtons.btnAddEntry.style.visibility = 'visible'
document.frmButtons.btnBack.style.visibility = 'visible'
document.frmButtons.btnPrint.style.visibility = 'visible'
}
</SCRIPT>
<FORM name="frmButtons" action="">
<INPUT type="button" name="btnAddEntry" value="Add a new task">
<INPUT type="button" name="btnBack" value="Back">
<INPUT type="button" name="btnPrint" onClick="Javascript: doPrint()" value="Print">
</FORM>
Worth:
Length:
Technical:
Comments:
In modern browsers, this is simple with CSS. Assign the button a class, say
<INPUT class="noprint" type="button" name="btnPrint" onClick="Javascript: doPrint()" value="Print">
Then in your stylesheet, include the following:
@media print {
.noprint {display:none}
}
You can add the same class to anything else that you want to hide during printing.