Javascript onkeypress [英] Javascript onkeypress

查看:70
本文介绍了Javascript onkeypress的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Javascript上的onkeypress事件有疑问。

I have a question regarding the onkeypress event on Javascript.

是否可以检测到Just Ctl键或Alt键?如果同时按下Ctl和m,则onkeypress事件可以触发点击。是否可以单独执行Ctl键?

Is it possible to detect Just Ctl key or Alt Key? At the moment if both Ctl and m are pressed the onkeypress event can trigger a click. Is it possible to do just Ctl key by itself?

期待您的评论

推荐答案

onkeypress 只捕获字符键。其他键使用 onkeydown 和/或 onkeyup 。请参阅 Peter-Paul Koch关于重要事件

onkeypress just catches character keys. Use onkeydown and/or onkeyup for the other keys. See Peter-Paul Koch on key events.

这篇关于Javascript onkeypress的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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