给页面定义热键
作者:不详时间: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>
评论数: 来源:不详
关键字:页面
相关文章


