我不知道这是如何工作的。我正在尝试学习关键事件。我让 keydown 工作,但 key up 不起作用。任何帮助表示赞赏。
window.onload = function(){
window.addEventListener('keyup' , loopit1 ); // this doesn't work.
/*window.addEventListener('keydown' , loopit2 );*/ // this works. That's why it's commented out.
function loopit1(e){
if(e.ctrlKey){
alert("Key Up!");
}
//This doesn't work.
}
/*function loopit2(e){
if(e.ctrlKey){
alert("Key Down!");
}
}*// This Works. That's why it's commented out.
}