您的位置:网大 >> 网络 >> 网页制作 >> 正文

给页面定义热键

作者:不详时间:2006-1-18 11:49:22

把下面代码copy入你html文件的<head>和</head>中再按一下b键试试:
<script>
vartravel=true
varhotkey=98/*hotkey即为热键的键值,是ASII码,这里98代表b键*/
vardestination="../index.htm"/*在此定义热键对应的页面*/
if(document.layers)
document.captureEvents(Event.KEYPRESS)
functiongogo(e){
if(document.layers){
if(e.which==hotkey&&travel)
window.location=destination
}
elseif(document.all){
if(event.keyCode==hotkey)
window.location=destination
}
}
document.onkeypress=gogo
</script>


评论数: 来源:不详


网大首页 - 网站地图 - 广告服务 - 关于网大 - 招聘信息 - 联系我们
Copyright (C) 1999-2005 NETBIG.COM (CHINA) LIMITED All Rights Reserved
粤B-20050190