Disable left mouse button with out alert message

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nagmvs
    New Member
    • Aug 2008
    • 49

    Disable left mouse button with out alert message

    Hai guys,

    I want the the code to disable Left Mouse button with out Alert message.

    Below code i am having

    Code:
    <!-- This code is for disableing left click-->
    <script language="javascript">
    function noClick() {
    if (event.button==1) {
    alert('You cannot click')
    }
    }
    document.onmousedown=noClick
    </script>
    i am having the above code with alert mesage.so can any one disable the alert message form the above code ? or send some other code for disable left mouse button with out alert message.
    It's urgent.

    Thanks,
    Nagesh.
    Last edited by acoder; Sep 12 '08, 12:11 PM. Reason: Added [code] tags
  • Ferris
    New Member
    • Oct 2007
    • 101

    #2
    Hi
    [HTML]
    <script language="javas cript">
    function noClick() {
    if (event.button== 1) {
    return false;
    alert('You cannot click');
    }
    }
    document.onmous edown=noClick;
    </script>
    [/HTML]

    you mean this? or you want to forbidden user click in your web page?

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      The code is not cross-browser. 'event' is not global in most browsers.

      Try something like this instead (right mouse detect).

      The language attribute is deprecated. Use type="text/javascript" instead.

      Comment

      • nagmvs
        New Member
        • Aug 2008
        • 49

        #4
        Originally posted by acoder
        The code is not cross-browser. 'event' is not global in most browsers.

        Try something like this instead (right mouse detect).

        The language attribute is deprecated. Use type="text/javascript" instead.

        Thanks for ur reply.

        Comment

        Working...