支持按键盘方向键翻页跳转的代码

来源:互联网 发布:软件公司java笔试题 编辑:程序博客网 时间:2024/05/24 04:58

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312" />
<title>支持按键盘方向键翻页跳转的代码</title>
</head>

<body>
<p>
  <SCRIPTlanguage=javascript>
   document.onkeydown = chang_page;
    functionchang_page() {
       if (event.keyCode == 37 || event.keyCode == 33) location ='http://www.maitianquan.com';
       if (event.keyCode == 39 || event.keyCode == 34) location ='http://www.lanrentuku.com'
    }
  </SCRIPT>
说明:按键盘← →方向键 或 PageUpPageDown键直接翻页</p>
</body>
</html>

 

 

http://www.lanrentuku.com/js/website-699.html

0 0