Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable Browser print button

Status
Not open for further replies.

spazman

Programmer
May 29, 2001
500
CA
Is it possible to disable the browser print button, in IE only. It's for our Intranet, we have reports that people insist on using the browser print button instead of the Print Function we have added that just prints the content and not our menus etc.
 
You could do something like this....

<style media=&quot;print&quot;>
.hideClass {display: none;}
.showClass {display: block:}
</style>


<script>
function printAll(){
document.getElementById(&quot;bodyNode&quot;).className = &quot;showClass&quot;
window.print()
}
</script>

<body id=&quot;bodyNode&quot; className=&quot;hideClass&quot;>

<input type=button value=&quot;Print&quot; onCLick=&quot;printAll()&quot;>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
This will disable the print button? I have the code to print just the content.
 
This will print a blank page when they use the print button - you could get even a little more elaborate and print &quot;Please use print button&quot; on the blank page...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
I actually just use the <style media=&quot;print&quot;> in my menu DIV or TABLE tags and hide them. That way the use can use their print button and I can still control the display...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
I guess I could change window.print() to alert('Please use the Cntent Print Button')

Thanks
 
No - the function only gets called when the user clicks your button - the browser's print button will always allow the user to print the page...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
well, I believe that there is an onprint function ... but I would imagine that only ie 5.7..9.2 only supports it LOL

Robert Carpenter
--------------------
&quot;Isn't it funny how you are perfectly content with being alone until nobody else is?&quot;
--------------------
linkemapx@hotmail.com

- use it, you wont regret it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top