Disable Mouse Left Click and Right Click Using Javascript in Asp.Net

Disable Mouse Left Click and Right Click

Webform Mouse Left Click  and Right Click  Disable User Click on Browser Using in Asp.Net C#.

                                  DEMO



                                Download

                            HTML Coding

<html lang="en">
<head>
  <title>Disable Mouse Left and Right Click Using Javascript in Asp.Net</title>
    <script type="text/javascript">
       
        // Disable Mouse Left and Right Click

        function Disable_Mouse(e)
        {
           // 0 - Left Click
            // 2  - Right Click

            if (event.button == 0)
            {
                alert('Left Click Disabled');
                return false;
            }
            else if (event.button == 2)           
            {
                alert('Right Click Disabled');
                return false;
            }
        }
       document.onmousedown = Disable_Mouse;
       document.onmouseup = Disable_Mouse;
       document.onclick = Disable_Mouse;
      
    </script>

    </head>
<body>

</body>

</html>



Add New WebForm - Button Event  Assign Return False Left=0,Right=2



1 comments:

Post a Comment