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;
};shift,ctrl,alt按键的获取
最新推荐文章于 2022-06-08 15:22:16 发布
本文介绍了一种使用JavaScript监听并捕获用户按下键盘组合键的方法,包括shift键、ctrl键和alt键等常用组合。

3416

被折叠的 条评论
为什么被折叠?



