获取输入的键
Code表API:https://github.com/lamberta/html5-animation
window.addEventListener("keydown",function(event){
switch(event.keyCode)
{
case 37:
console.log("您敲下了←键");
break;
case 38:
console.log("您敲下了↑键");
break;
case 39:
console.log("您敲下了→键");
break;
case 40:
console.log("您敲下了↓键");
break;
}
},false);