Home >Web Front-end >JS Tutorial >JS input digital verification code_javascript skills
/*
**@The control can only input numbers, including - (negative sign). (decimal point)
**@Inline HTML:
**@Event property: object. attachEvent("onkeypress",onlyNumber);object.style.imeMode = "disabled";
**@Author:wangwq@atools
*/
function onlyNumber(){
if(!( ((window.event.keyCode >= 48) && (window.event.keyCode || (window.event.keyCode == 13) || (window.event.keyCode == 46)
|| (window.event.keyCode == 45))){
window.event.keyCode = 0 ;
}
}
// This function is used to limit the text input box Only numbers "0" to "9" can be entered in
//@Inline HTML:
//@Event property: object.attachEvent("onkeypress",JHshNumberText);object.style. imeMode = "disabled";
function JHshNumberText()
{
if ( !(((window.event.keyCode >= 48) && (window.event.keyCode {
window.event.keyCode = 0 ;
}
}