復制代碼 代碼如下:
<script type="text/javascript">
function up(){ alert("up");}
function down(){alert("down");}
function left(){ alert("left");}
function right(){alert("right");}
function jumpPage(){
if(event.keyCode==37){
left(); return ;
}
if(event.keyCode==38){
up();return ;
}
if(event.keyCode==39){
right();return ;
}
if(event.keyCode==40){
down();return ;
}
document.onkeydown=jumpPage;
}
</script>