上代码
function test(event)
{
if(event.button == 0)
{
alert("0");
}
else if(event.button == 1)
{
alert("1");
}
else if(event.button == 2)
{
alert("2");
}
else if(event.button == 4)
{
alert("4");
}
}<input type="button" id="bt1" value="尼玛" onclick="test(event)">现在我始终按住鼠标左键或中键或右键,然后用tab落定到这个按钮用回车触发函数
为什么提示出来都是0
ie 和 ff都是一样效果我在一些教程上看到的是
button 事件属性可返回一个整数,指示当事件被触发时哪个鼠标按键被点击。
参数 描述 
0 规定鼠标左键。 
1 规定鼠标中键。 
2 规定鼠标右键。 
Internet Explorer 拥有不同的参数:
参数 描述 
1 规定鼠标左键。 
4 规定鼠标中键。 
2 规定鼠标右键。 
他们给的参考代码:
function whichButton(event)
  {
    if (event.button==2)
      {
      alert("You clicked the right mouse button!")
      }
    else
      {
      alert("You clicked the left mouse button!")
      }
  }求问何解