| numReg;
var value = obj.value;
var strValueTemp, strInt, strDec;
//alert(value + "=====" + len + "====="+ pric);
try{
numReg =/[\-]/;
strValueTemp = value.replace(numReg, "");
strValueTemp = strValueTemp.replace(numReg, "");
//整数
if(pric==0){
numReg =/[\.]/;
//alert(numReg.test(value));
if(numReg.test(value) == true){
f_alert(obj, "输入必须为整数类型!");
return false;
}
}
if(strValueTemp.indexOf(".") < 0 ){
//alert("lennth==" + strValueTemp);
if(strValueTemp.length >( len - pric)){
f_alert(obj, "整数位不能超过"+ (len - pric) +"位");
return false;
}
}else{
strInt = strValueTemp.substr( 0, strValueTemp.indexOf(".") );
//alert("lennth==" + strInt);
if(strInt.length >( len - pric)){
f_alert(obj, "整数位不能超过"+ (len - pric) +"位");
return false;
}
strDec = strValueTemp.substr( (strValueTemp.indexOf(".")+1), strValueTemp.length );
//alert("pric==" + strDec);
if(strDec.length > pric){
f_alert(obj, "小数位不能超过"+ pric +"位");
return false;
}
}
return true;
}catch(e){
ale << 上一页 [11] [12] [13] [14] [15] [16] 下一页 |