hello all. i have html page to be printed out..it's generated by the button print like below
<input type="button" name="btn_print " value="Print Invoice" onClick="javasc ript:window.pri nt();">
of course, the button will shown to the page when it's printed..
but i don't want that button shown when user print the page (paper) or when the user commands "print preview" in the browser...
Than, i already solve the request with this function below..
and the body HTML is like below :
<body onafterprint="j avascript:DoNot Print();"onbefo reprint="javasc ript:DoNotPrint ();">
so, when user commands print preview or print the page, the button "btn_print" above, will not shown..
the problem is, that's works only in IE, doesn't work in mozilla...
so, any idea???
thanks before
regards, maminx
<input type="button" name="btn_print " value="Print Invoice" onClick="javasc ript:window.pri nt();">
of course, the button will shown to the page when it's printed..
but i don't want that button shown when user print the page (paper) or when the user commands "print preview" in the browser...
Than, i already solve the request with this function below..
Code:
<script type="text/javascript">
// Hide tags with id="noprint" when printing
function DoNotPrint()
{
var a = document.all.item("noprint");
if (a!=null) {
if (a.length!=null) {
//multiple tags found
for (i=0; i < a.length; i++) {
a(i).style.display = window.event.type == "beforeprint" ? "none" :"inline";
}
} else
//only one tag
a.style.display = window.event.type == "beforeprint" ? "none" :"inline";
}
}
</script>
<body onafterprint="j avascript:DoNot Print();"onbefo reprint="javasc ript:DoNotPrint ();">
so, when user commands print preview or print the page, the button "btn_print" above, will not shown..
the problem is, that's works only in IE, doesn't work in mozilla...
so, any idea???
thanks before
regards, maminx
Comment