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需刷新才能执行]
有用 | 无用
<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需刷新才能执行]
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- JavaScript 监听textarea中按键事件
- jquery 最简单的属性菜单
- Javascript 日期处理之时区问题
- 学习ExtJS table布局
- 学习ExtJS accordion布局
- 学习ExtJS form布局
- 学习ExtJS fit布局使用说明
- 学习ExtJS border布局
- 学习ExtJS Column布局
- 学习ExtJS 访问容器对象
- 学习ExtJS Window常用方法
- 学习ExtJS Panel常用方法
- 学习ExtJS TextField常用方法
- 学习ExtJS(二) Button常用方法
- 学习ExtJS(一) 之基础前提
- JavaScript 控制文本框的值连续加减
- 兼容多浏览器的JS 浮动广告[推荐]
- CSS 布局一个漂亮的滑块
- CSS 美化表格边框为凹陷立体效果的实现方法