实现代码如下:

document.onclick = function(e){
alert(getKey(e));
};
function getKey(e){
var e = e || window.event;
var keys = [];

if(e.shiftKey){
keys.push("shift键");
};
if(e.ctrlKey){
keys.push("ctrl键");
};
if(e.altKey){
keys.push("alt键");
};
return keys;
};

以上就是【原生js实现shift/ctrl/alt按键的获取】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)

与本文相关的软件

发表我的评论

最新评论

  1. 暂无评论