Monday, April 8, 2013

Disable right click control and many keys

function DisableRightClick(event)
       {
               if (event.button==2)
               {
               alert("Right Clicking not allowed!");
               }
       }


 function DisableCtrlKey(e)
           {
               var code = (document.all) ? event.keyCode:e.which;
               var message = "Ctrl key functionality is disabled!";
               if (parseInt(code)==17)
                       {
                       alert(message);
                       window.event.returnValue = false;
                       }
               if (parseInt(code)==18)
                       {
                       alert("Alt key functionality is disabled!");
                       window.event.returnValue = false;
                       }
               if (parseInt(code)==32)
                       {
                       alert("Space key is disabled");
                       window.event.returnValue = false;
                       }
               if (parseInt(code)==45)
                       {
                       alert("Insert key is disabled!");
                       window.event.returnValue = false;
                       }
           }

oncopy="return false;" onpaste="return false;" oncut="return false;" ondragstart="return false" onselectstart="return false"

No comments:

Post a Comment