$obj.LIGvalidata();
self.validateAfter=function(){};//验证成功后调用
self.init=function(){}//初始化
self.validateonly=function(){};//仅仅验证,返回验证结果,true/false
self.validate=function(){};//开始验证 成功后执行validateAfter方法
//会验证$obj中所有包含vali属性的input,textare
示例:
<input type="text" vali="empty"/>
var self=$obj.LIGvalidata();
self.validateAfter=function(){};
self.init();
slef.validate();
vali内容:
window.regExps={
\\\'empty\\\':{reg:/\\\\S/,info:"不能为空!"},
\\\'phone\\\':{reg:/^((\\\\(\\\\d{2,3}\\\\))|(\\\\d{3}\\\\-))?(\\\\(0\\\\d{2,3}\\\\)|0\\\\d{2,3}-)?[1-9]\\\\d{6,7}(\\\\-\\\\d{1,4})?$/,info:"电话格式不对!"},
\\\'email\\\':{reg:/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\\\\.[a-zA-Z0-9_-]{2,3}){1,2})$/,info:"Email格式不对!"},
\\\'url\\\':{reg:/^http:\\\\/\\\\/[A-Za-z0-9]+\\\\.[A-Za-z0-9]+[\\\\/=\\\\?%\\\\-&_~`@[\\\\]\\\\\\\':+!]*([^<>\\\\"\\\\"])*$/,info:"url格式不对!"},
\\\'badstr\\\':{reg:/^[^\\\\^\\\\\\\\%&\\\\*\\\'\\\\?\\\\/\\\\<\\\\>\\\\|\\\\"`]*$/,info:"不能含有特殊字符><\\\'?%&"},
\\\'float3\\\':{reg:/^\\\\d{1,9}[.]\\\\d{1,1}$/,info:\\\'只能输入小数为1位的正实数\\\'},
\\\'emptyorfloat3\\\':{reg:/(^$)|(^\\\\d{1,9}[.]\\\\d{1,1}$)/,info:\\\'为空或只能输入小数为1位的正实数\\\'},
\\\'numberorfloat1\\\':{reg:/^[0-9]+(.[0-9]{1,1})?$/,info:\\\'只能输入整数或小数为1位的正实数\\\'},
\\\'numberorfloat3\\\':{reg:/^-?\\\\d+(\\\\.\\\\d{1,3})?$/,info:\\\'只能输入整数或小数为3位的正实数\\\'},
\\\'nfloat3\\\':{reg:/^[-][0-9]+(.[0-9]{1,1})?$/,info:\\\'只能输入小数为1位的负实数\\\'},
\\\'pnfloat3\\\':{reg:/^[+-]?[0-9]+(.[0-9]{1,1})?$/,info:\\\'只能输入小数为1位的实数\\\'},
\\\'pnfloat3ornull\\\':{reg:/^(\\\\\\\\s*|([+-]?[0-9]))+(.[0-9]{1,3})?$/,info:\\\'为空或者只能输入小数为3位的实数\\\'},
\\\'pnfloat1ornull\\\':{reg:/^(\\\\\\\\s*|([+]?[0-9]))+(.[0-9]{1,3})?$/,info:\\\'为空或者只能输入正实数\\\'},
\\\'number\\\':{reg:/^[0-9]*$/,info:\\\'只能输入数字\\\'},
\\\'number100\\\':{reg:/^(?:0|[1-9][0-9][0-9]?|100)$/,info:\\\'只能输入0-100的正整数\\\'},
\\\'number1000\\\':{reg:/^(?:0|[1-9][0-9][0-9][0-9]?|9000)$/,info:\\\'只能输入0-9999的正整数\\\'},
\\\'intervalvalue\\\':{reg:/^(\\\\(|\\\\[)([-+]?\\\\d+(\\\\.\\\\d+)?),([-+]?\\\\d+(\\\\.\\\\d+)?)(\\\\)|\\\\])$/,info:\\\'区间值格式错误,应为[x,y](x,y)[x,y)(x,y]\\\'},
\\\'number3orfloat3\\\':{reg:/^(?:0|[1-9]\\\\d{0,2})(\\\\.\\\\d{1,3})?$/,info:\\\'只能输入小于1000、小数最多为3位的正实数\\\'},
};