Advertisement
bau-de-incertezas

Botão direito

Nov 6th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. //desabilita botao direito
  2. function desabilitaBotaoDireito(e)
  3. {
  4. if (window.Event)
  5. {
  6. if (e.which == 2 || e.which == 3)
  7. return false;
  8. }
  9. else
  10. if (event.button == 2 || event.button == 3)
  11. {
  12. event.cancelBubble = true
  13. event.returnValue = false;
  14. return false;
  15. }
  16. }
  17.  
  18. //desabilita botao direito do mouse
  19. if ( window.Event )
  20. document.captureEvents(Event.MOUSEUP);
  21. if ( document.layers )
  22. document.captureEvents(Event.MOUSEDOWN);
  23.  
  24. document.oncontextmenu = desabilitaMenu;
  25. document.onmousedown = desabilitaBotaoDireito;
  26. document.onmouseup = desabilitaBotaoDireito;
  27. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement