document.onkeydown = function(e){
var key = window.event.keyCode;
console.log(key);
// if(key == 13){
// console.log(1);
// }
}
按下抬起时触发
onkeyup
document.onkeydown = function(e){
var key = window.event.keyCode;
console.log(key);
// if(key == 13){
// console.log(1);
// }
}
onkeyup
本文标题:js监听键盘事件
本文链接:https://www.haomeiwen.com/subject/cmesfctx.html
网友评论