js & listen mouse click

js & listen mouse click

how to listen mouse click in js

https://www.kirupa.com/html5/mouse_events_in_javascript.htm


document.addEventListener("mousedown", buttonPress, false); function buttonPress(e) {
if (e.button == 0) {
console.log("Left mouse button pressed!");
} else if (e.button == 1) {
console.log("Middle mouse button pressed!");
} else if (e.button == 2) {
console.log("Right mouse button pressed!");
} else {
console.log("Things be crazy up in here!!!");
}
}

https://*.com/questions/2405771/is-right-click-a-javascript-event

https://*.com/questions/26267667/how-to-listen-for-a-mouse-click-in-a-javascript-game

上一篇:面试:做过sql优化吗?


下一篇:Android中多个调用Activity的问题