<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<!-- 通常是给document添加 -->
<script>
// 键盘按下事件
document.onkeydown=function(){
console.log("键盘按下事件");
}
// 键盘抬起事件
document.onkeyup=function(){
console.log("键盘抬起事件");
}
</script>
</body>
</html>