<input type="button" name="btn_print" value="Print Invoice" onClick="javascript:window.print();">
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..
Expand|Select|Wrap|Line Numbers
- <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="javascript:DoNotPrint();"onbeforepri nt="javascript: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