JavaScript automatic verification function (3) -int check

xiaoxiao2021-03-06  28

/ *** Checkinteger function verifies whether this box is input to the integer type data, the returned value is true and false, true and false; ** Object target object, Desc English description. * /

Function Checkinteger (Object, DESC) {

Var strinteger = Object.value;

IF (strinteger.length == 0) {

Return True;

} else {

VAR pattern = / ^ -? / d $ /;

IF (strinteger.match (pattern) == null) {

Alert ("" desc "" must be a number, please modify! ");

Object.focus ();

Return False;

} else {

Return True;

}

}

}

转载请注明原文地址:https://www.9cbs.com/read-82522.html

New Post(0)