Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Shubham Malhotra
Added: Dec 20, 2017 7:50 PM
Views: 7
Tags: no tags
  1. var isCtrl = false;
  2. document.onkeyup=function(e)
  3. {
  4. if(e.which == 17)
  5. isCtrl=false;
  6. }
  7. document.onkeydown=function(e)
  8. {
  9. if(e.which == 17)
  10. isCtrl=true;
  11.  
  12. {
  13. // alert(‘Keyboard shortcuts are cool!’);
  14. return false;
  15. }
  16. }
  17. var isNS = (navigator.appName == "Netscape") ? 1 : 0;
  18. if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
  19. function mischandler(){
  20. return false;
  21. }
  22. function mousehandler(e){
  23. var myevent = (isNS) ? e : event;
  24. var eventbutton = (isNS) ? myevent.which : myevent.button;
  25. if((eventbutton==2)||(eventbutton==3)) return false;
  26. }
  27. document.oncontextmenu = mischandler;
  28. document.onmousedown = mousehandler;
  29. document.onmouseup = mousehandler;