点击键盘上的事件:上,下,左,右 [英] Click event on the keyboard: up, down, left, right
本文介绍了点击键盘上的事件:上,下,左,右的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一个点击右,上,下或左的事件。我想要一个条件满足(如果)他点击我选择的按钮,下面是一个应该适合的例子:
I need an event that gives one click right, up, down or left. I want that when a condition is met (if) he give a click on the button I choose, below is an example in which should fit:
if(gesture.left){
左侧方向按钮小键盘上的点击事件
}否则if(gesture.right){
单击正确方向按钮上的事件按钮键盘
}
不想检测按下哪个键,只有一个条件,他点击按钮我想要的
Do not want to detect which key was pressed, only one condition that after he click button that I want.
推荐答案
箭头键仅由 onkeydown
触发,而不是 onkeypress
arrow keys are only triggered by onkeydown
, not onkeypress
键码是:
- left = 37
- up = 38
- right = 39
- down = 40
- left = 37
- up = 38
- right = 39
- down = 40
http:// jsfiddle .net / ahmadhasankhan / qqqpf / 2 /
这篇关于点击键盘上的事件:上,下,左,右的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文