Advertisement
atulquest99

Disable_Right_click_javascript

Mar 16th, 2012
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script language=JavaScript>
  2. <!--
  3.  
  4. //Disable Right Click Script
  5. //by atulquest99
  6. //http://www.blogtyro.blogspot.com
  7.  
  8. var message="Function Disabled!";
  9.  
  10. ///////////////////////////////////
  11. function clickIE4(){
  12. if (event.button==2){
  13. alert(message);
  14. return false;
  15. }
  16. }
  17.  
  18. function clickNS4(e){
  19. if (document.layers||document.getElementById&&!document.all){
  20. if (e.which==2||e.which==3){
  21. alert(message);
  22. return false;
  23. }
  24. }
  25. }
  26.  
  27. if (document.layers){
  28. document.captureEvents(Event.MOUSEDOWN);
  29. document.onmousedown=clickNS4;
  30. }
  31. else if (document.all&&!document.getElementById){
  32. document.onmousedown=clickIE4;
  33. }
  34.  
  35. document.oncontextmenu=new Function("alert(message);return false")
  36.  
  37. // -->
  38. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement