1 function validSpecialCharacter(fieldname,fielddesc){ 2 3 var value = $.trim($("#key_"+fieldname).val()); 4 var pattern=/[\^\&<>\\\\/]/im; 5 var flag = pattern.test(value); 6 if(flag) { 7 alert("【"+fielddesc+"】不能包含特殊字符<>^\&\\\/"); 8 return -1; 9 }10 else11 return 0;12 }