加入端口/端口掩码验证,中/英/俄文国际化
This commit is contained in:
@@ -245,6 +245,16 @@ jQuery.validator.addMethod("ipMask",function(value, element) {
|
||||
}else{return (obj > 0) && ((obj & (obj - 1)) == 0)};
|
||||
}
|
||||
}, "请填写正确的IP地址掩码");
|
||||
jQuery.validator.addMethod("portCheck",function(value, element) {
|
||||
if(value.length==0||value.trim().length==0){return true;}
|
||||
obj=value;
|
||||
var typeInt=$(element).parents(".row").siblings().find("select[name$='portPattern']").val();
|
||||
if(typeInt==1){//port 0~65535
|
||||
return this.optional(element)||(/^([0-9]+)$/.test(value) && (RegExp.$1 <=65535 && RegExp.$1 >=0));
|
||||
}else if(typeInt==2){// port -mask 0~65535/0~65535
|
||||
return this.optional(element)||(/^([0-9]+)\/([0-9]+)$/.test(value) && (RegExp.$1 <=65535 && RegExp.$2 <=65535 && RegExp.$1<RegExp.$2));
|
||||
}
|
||||
}, "请填写正确的端口");
|
||||
//ip v4转数字
|
||||
var ipToNumber=function (ip){
|
||||
var num =0;
|
||||
|
||||
Reference in New Issue
Block a user