xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

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://stackoverflow.com/questions/2405771/is-right-click-a-javascript-event

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

refs



©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2019-01-18 15:17  xgqfrms  阅读(329)  评论(0编辑  收藏  举报