是否有可能处理起来在HTML输入字段/下键? [英] Is it possible to handle up/down key in HTML input field?

查看:106
本文介绍了是否有可能处理起来在HTML输入字段/下键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立输入文本字段自动完成功能。目前,我可以用鼠标点击来选择的选择,我想添加键盘控制,允许自动完成控制。我监测的关键code在onkeyup事件,似乎为上/下键,键codeS均为0。

I am building a autocomplete feature for input text field. Currently I could use mouse click to choose the selection, I'd like to add keyboard control to allow autocomplete control. I monitored the keycode in onkeyup event, it appears for up/down key, the key codes are both 0.

我想知道是否有更好的方法来做到这一点。

I am wondering whether there is any better way to do so.

感谢。

推荐答案

重点$ C $ 37的CS - 40应该为你做它。它们映射为37 =左,38 =上,39 =右,40 =下来。

Keycodes 37 - 40 should do it for you. They map as 37=left, 38=up, 39=right, 40=down.

这篇关于是否有可能处理起来在HTML输入字段/下键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆