js如何判断鼠标左键是否按下

来源:互联网 发布:c语言99乘法表倒三角 编辑:程序博客网 时间:2024/05/17 03:14
JS中判断鼠标按键的问题。 
IE
左键是 window.event.button = 1
右键是 window.event.button = 2
中键是 window.event.button = 4
没有按键动作window.event.button = 0

Firefox
左键是 event.button = 0
右键是 event.button = 2
中键是 event.button = 1
没有按键动作 event.button = 0

Opera 7.23/7.54
鼠标左键是 window.event.button = 1
没有按键动作 window.event.button = 1
右键和中键无法获取

Opera 7.60/8.0
鼠标左键是 window.event.button = 0
没有按键动作 window.event.button = 0
右键和中键无法获取

另外:屏蔽右键的是window.event.button = 3
原创粉丝点击