给页面定义热键
http://www.webjx.com 更新日期:2005-02-25 10:14 出处:网页教学网 作者:
|
把下面代码copy入你html文件的<head>和</head>中再按一下b键试试:
<script> var travel=true var hotkey=98 /* hotkey即为热键的键值,是ASII码,这里98代表b键 */ var destination="../index.htm" /* 在此定义热键对应的页面 */ if (document.layers) document.captureEvents(Event.KEYPRESS) function gogo(e){ if (document.layers){ if (e.which==hotkey&&travel) window.location=destination } else if (document.all){ if (event.keyCode==hotkey) window.location=destination } } document.onkeypress=gogo </script> |
|
您的评论
·用户发表意见仅代表其个人意见,并且承担一切因发表内容引起的纠纷和责任
·本站管理人员有权在不通知用户的情况下删除不符合规定的评论信息或留做证据
·请客观的评价您所看到的资讯,提倡就事论事,杜绝漫骂和人身攻击等不文明行为