1 function validCommaCharacter(fieldname,fielddesc){ 2 3 var value = $.trim($("#key_"+fieldname).val()); 4 var pattern=/^\d+([,,]\d+)*$/; 5 var flag = pattern.test(value); 6 if(!flag) { 7 alert("【"+fielddesc+"】逗号只能存在于数字中间"); 8 return -1; 9 }10 else11 return 0;12 }