var heightData = {
reg:'^(\\d{1,3}(\\.\\d+)?|1000(\\.|\\.0{1})?)$',
warn:$.i18n.prop('com_zte_lte_projectparametermanage_create_warn_100'),
property:'height'
};
this.blurData('height',heightData,this.checkBL);
checkBL:function(e){
var data = e.data;
var reg = new RegExp('' + e.data.reg,'g');
var value = this.value;
var warn100 = data.warn;
var property = data.property;
if(value == ''){
this.placeholder = warn100;
checkArrIntance[property] = true;
}
if(value.slice(-1) == '.'){
this.value = value.slice(0,-1);
}
if(reg.test(this.value)){
$(this).removeClass('input-border');
checkArrIntance[property] = true;
}else{
$(this).addClass('input-border');
this.placeholder = warn100;
this.value = '';
checkArrIntance[property] = false;
}
}
问题出现在传递正则表达式对象的地方,不能够直接使用reg=/^(\d{1,3}(\.\d+)?|1000(\.|\.0{1})?)$/g;
这种字面量的方式,必须使用上文的new 对象方法才可