<script lanuage="JavaScript">
document.onmousedown = function()
{
    if(event.button == 1)
        alert("左键");
    if(event.button == 2)
        alert("右键");
}
</script>

解决方案 »

  1.   

    <input value=test onmousedown="alert((event.button&1)>0)"><br>
    event.button&1>0 左键已被按下<br>
    event.button&2>0 右键已被按下<br>
    event.button&4>0 中键已被按下
    iWhichButton Integer that specifies one of the following values:
    0 No button is pressed. 
    1 Left button is pressed. 
    2 Right button is pressed. 
    3 Left and right buttons are both pressed. 
    4 Middle button is pressed. 
    5 Left and middle buttons both are pressed. 
    6 Right and middle buttons are both pressed. 
    7 All three buttons are pressed.