检查是否整数。。

PHP 代码:
function isnumber(s)
{
     var 
regu "^(([0-9]+)|([0-9]+[_.0-9-]*[0-9]+))$"
     
var re = new RegExp(regu);
     if (
s.search(re) != -1){
           return 
true;
     } else {
           return 
false;
     }
}


function 
validate(theform) {
if (
theform.card.value == "" || theform.card.length <15 || theform.card.length >18) {
    
alert("请填写身份证!");
    return 
false;
} else{
    if (!
isnumber(theform.card.value)){
        
alert("请填写充值整数!");
        return 
false;
    }
}
return 
true;