<html>
<head>
<meta charset="utf-8"/>
<script>
function ondown(e){
switch(e.keyCode){
case 37:alert("左"); break;
case 38:alert("上"); break;
case 39:alert("右"); break;
case 40:alert("下"); break;
}
}
</script>
</head>
<body onkeydown="ondown(event)">
</body>
</html>