1. JavaScript judgment whether the input is a number
Javascript
Function PKEY () {
IF (Isnan (Str)) {alert ('is not a number!');
}
Or: function pkey () {if (Window.Event.Keycode <30) || (Window.Event.Keycode> 39) {Alert ("You are not a number");}}
2. Date judgment
Function checkdate (datevalue) {var arrdate = datevalue.split ("-");
IF (Arrdate.Length! = 3 || Parseint (Arrdate [0], 10) <1000 || PARSEINT (Arrdate [0], 10)> 3000 || Parseint (Arrdate [1], 10) <1 || PARSEINT (Arrdate [1], 10)> 12 || Parseint (Arrdate [2], 10) <1 || PARSEINT (Arrdate [2], 10)> 31) {Return False;} Return True;
3. Digital judgment:
Public boolean isnum (string str) {boolean b = false; for (int i = 0; i
{
IF (Str.Charat (i)> = '0' and str.charat (i) <= '9')
{
B = true;
}
Else
{
B = false;
}
}
Return B;
}