JavaScript 接收键盘指令示例

  作者:bea

请按下键盘上的A键,会跳转到的首页 <SCRIPT language="JavaScript"> <!-- var hotkey=97 var destination="http://" if (document.layers) document.captureEvents(Event.KEYPRESS) function backhome(e){ if (document.layers){ if (e.which==hotkey) window.loc
请按下键盘上的A键,会跳转到的首页



<SCRIPT language="JavaScript">
<!--
var hotkey=97
var destination="http://"
if (document.layers)
document.captureEvents(Event.KEYPRESS)
function backhome(e){
if (document.layers){
if (e.which==hotkey)
window.location=destination
}
else if (document.all){
if (event.keyCode==hotkey)
window.location=destination
}
}
document.onkeypress=backhome
onkeydown="javascript:onenter();"
function onenter(){
if(event.keyCode==13){
alert("回车");
}
}
-->
</SCRIPT>




[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行]



有用  |  无用

猜你喜欢