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

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

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