Detect left mouse button press

后端 未结 5 1784
没有蜡笔的小新
没有蜡笔的小新 2020-11-29 06:44

I hate this mess with the mouse buttons created by W3C an MS! I want to know if the left mouse button is pressed when I get a mousedown event.

I use this code

5条回答
  •  被撕碎了的回忆
    2020-11-29 06:50

    You can use the following code-

    onmouseup="if(window.event.which==1){//code for left click}
               else if(window.event.which==3){//code for right click}"
    

提交回复
热议问题