Advertisement
polinomial

DISABLING THE RIGHT CLICK.

Nov 26th, 2011
977
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script language="JavaScript">
  2. var message="";
  3. function clickIE4() {
  4.    if (event.button == 2) {
  5.       alert(message);
  6.       return false;
  7.       }
  8.    }
  9. function clickNS4(e) {
  10.    if (document.layers || document.getElementById &&!document.all) {
  11.       if (e.which == 2 || e.which == 3) {
  12.          alert(message);
  13.          return false;
  14.          }
  15.       }
  16.    }
  17. if (document.layers) {
  18.    document.captureEvents(Event.MOUSEDOWN);
  19.    document.onmousedown = clickNS4;
  20.    }
  21. else if (document.all &&!document.getElementById) {
  22.    document.onmousedown = clickIE4;
  23.    }
  24. document.oncontextmenu = new Function("alert(message);return false")
  25. </script>
  26.  
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement