📜  javascript 键盘事件 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:58.343000             🧑  作者: Mango

代码示例2
document.addEventListener("keydown", function(event) {
  console.log(`Key pressed: ${event.key}`);
  // event.key is a string representing which key has been pressed
});