设热键进入相应的页面

来自「网页特效」· 代码 · 共 19 行

TXT
19
字号
<script>
var travel=true
var hotkey=98 /* hotkey即为热键的键值,是ASII码,这里98代表b键 */
var destination="http://lovehy.126.com/" /* 在此定义热键对应的页面 */
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> 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?