How can I check whether left or right mouse button has been clicked?

To determine whether the user clicked the left or right button, you can use the following properties. # Event.which in Netscape Navigator # event.button in Internet Explorer

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<script runat="server">


<html xmlns="" >
<head runat="server">
    <title>Untitled Page</title>
    <script type="text/javascript">
          function mouseDown(e)
                if (parseInt(navigator.appVersion)>3)
                    var clickType=1;
                     if (navigator.appName=="Netscape") clickType=e.which;
                    else clickType=event.button;
                    if (clickType==1)
                         self.status='Left button!';
                         alert("Left Button");
                if (clickType!=1)
                          self.status='Right button!';
                         alert("Right Button");
           return true;
          if (parseInt(navigator.appVersion)>3)
                document.onmousedown = mouseDown;
                if (navigator.appName=="Netscape")
    <form id="form1" runat="server">
    <asp:Panel ID="Panel1" runat="Server" GroupingText="Test">
    <asp:TextBox ID="txtBox" runat="Server"></asp:TextBox><br />
    <asp:Button ID="btnTest" runat="Server" Text="Submit" />
Next Post Previous Post
No Comment
Add Comment
comment url