當(dāng)前位置:
首頁(yè) >
前端技术
> javascript
>内容正文
javascript
[转]JS中判断鼠标按键判断
生活随笔
收集整理的這篇文章主要介紹了
[转]JS中判断鼠标按键判断
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
JS中判斷鼠標(biāo)按鍵的問(wèn)題。
IE
左鍵是 window.event.button = 1
右鍵是 window.event.button = 2
中鍵是 window.event.button = 4
沒(méi)有按鍵動(dòng)作window.event.button = 0
Firefox
左鍵是 event.button = 0
右鍵是 event.button = 2
中鍵是 event.button = 1
沒(méi)有按鍵動(dòng)作 event.button = 0
Opera 7.23/7.54
鼠標(biāo)左鍵是 window.event.button = 1
沒(méi)有按鍵動(dòng)作 window.event.button = 1
右鍵和中鍵無(wú)法獲取
Opera 7.60/8.0
鼠標(biāo)左鍵是 window.event.button = 0
沒(méi)有按鍵動(dòng)作 window.event.button = 0
右鍵和中鍵無(wú)法獲取
另外:屏蔽右鍵的是window.event.button = 3
轉(zhuǎn)載于:https://www.cnblogs.com/aooyu/archive/2009/12/14/1623967.html
總結(jié)
以上是生活随笔為你收集整理的[转]JS中判断鼠标按键判断的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: windchill开发之创建对象
- 下一篇: JSON与JAVA数据的相互转换(基本应