* 整数的判定
* @param type
* 为空 任意整数
* '0+' 非负整数
* '+' 正整数
* '-0' 非正整数
* '-' 负整数
*/
function isint(type){
var rt = new array();
if(type=="0+"){
rt[0] = "^\d+$";
rt[1] = "应输入非负整数!";
}else if(type=="+"){
rt[0] = "^\d*[1-9]\d*$";
rt[1] = "应输入正整数!";
}else if(type=="-0"){
rt[0] = "^((-\d+)|(0+))$";
rt[1] = "应输入非正整数!";
}else if(type=="-"){
rt[0] = "^-\d*[1-9]\d*$";
rt[1] = "应输入负整数!";
}else{
rt[0] = "^-?\d+$";
rt[1] = "应输入整数值!";
}
return rt;
}
时间: 2024-10-16 04:09:31