我自己写的几句,怎么console打印不了键码?
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<script>
window.onload=function()
{
document.onkeyup=function(event){
event = event || window.event;
console.log(event.keyCode);
};
}
</script>
<title>抽奖</title>
</head>
<body>
<div id="title" class="title">开始抽奖</div>
<div class="btns">
<span id="play">开始</span>
<span id="stop">停止</span>
</div>
</body>
</html>