How to confirm whether it is a valid keyboard input value by JavaScript
This article is about JavaScript's ability to determine if a valid keyboard input is valid. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
function checkKey(iKey) {
if (iKey == 32 || iKey == 229) {
return true;
} /* Spaces and exceptions */
if (iKey > 47 && iKey
< 58) { return true; } /*数字*/ if (iKey >64 && iKey
< 91) { return true; } /*字母*/ if (iKey >95 && iKey
< 108) { return true; } /*数字键盘1*/ if (iKey >108 && iKey
< 112) { return true; } /*数字键盘2*/ if (iKey >185 && iKey
< 193) { return true; } /*符号1*/ if (iKey >218 && iKey < 223) {
return true;
} /* Symbol 2*/
return false;
Thank you for reading! About "JavaScript how to confirm whether it is a valid keyboard input value" This article is shared here, I hope the above content can have some help for everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!