男子一米板:Htm或ASP,如何捕捉键盘输入(在线等)

来源:百度文库 编辑:高校问答 时间:2024/04/29 14:58:01
当键盘输入方向右时,我想让网页转到一个网址(http://www.test.com/),该如何写

<html>
<head>
<script language="javascript">
function redir(){
if(event.keyCode==39){
window.location="http://www.test.com/";
}
}
</script>
</head>
<body onKeyDown="redir()">
</body>
</html>

使用JAVASCRIPT可以控制

<script language="javascript">
function test()
{
if(event.keyCode==39)
window.location="http://www.test.com/"
}
document.onkeydown=test
</script>