JavaScript restricts the input to only numbers, determines the value of the Event.keycode, and restricts it to numbers only, and if it is not a number, returns an error and, if it is a number, continues.
Let me show you how to verify that JavaScript is a number another way, by using the following function:
function Isnumber (onum)
{
if (!onum) return false;
var strp=/^\d+ (\.\d+)? $/;
if (!strp.test (Onum)) return false;
try{
if (parsefloat (onum)!=onum) return false;
}
catch (ex)
{
return false;
}
return true;
}
This JavaScript code is very concise, you can see. Http://map.sogou.com/poi/1_D1000058002509.htm
There is a more stupid method, you can also see, learn
Next time you put a regular verification number.
The simplest JavaScript validation is not a number code as follows:
Using the Sinan function, click here to see the isNaN function description
JavaScript authentication is a digital