javascript减法( - )键码 [英] javascript subtract(-) keycode
本文介绍了javascript减法( - )键码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
109
和 189
密钥代码,但我仍然无法获得所需的结果。虽然我按 -
我没有得到那个警报框解决方案
您在按键事件期间测试的JavaScript charCodes 是 ASCII 。 109是正确的 keyCode ,如果在keydown或keyup事件中使用。
- 有一个 charCode 45美元。
ok, i need my code to check if minus/subtract/- was pressed, if it was pressed i want an alert box to pop. i tried with both 109
and 189
key codes but i still don't get the desired result. although i press "-"
i don't get that alert box
解决方案
The JavaScript charCodes, which you test for during a keypress event, are ASCII. 109 is the correct keyCode, if used in a keydown or keyup event.
"-" has a charCode of 45.
这篇关于javascript减法( - )键码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文