PageSourceSearch

https://zwfw.chaoyang.gov.cn/new/libs/js/form/Validform_v5.3.2.js

js chaoyang.gov.cn collected 2026-09-25 03:55:44 UTC 45,337 bytes, 1,333 lines download raw bytes

1/*
2    通用表单验证方法
3    Validform version 5.3.2
4	By sean during April 7, 2010 - March 26, 2013
5	For more information, please visit http://validform.rjboy.cn
6	Validform is available under the terms of the MIT license.
7	
8	Demo:
9	$(".demoform").Validform({//$(".demoform")指明是哪一表单需要验证,名称需加在form表单上;
10		btnSubmit:"#btn_sub", //#btn_sub是该表单下要绑定点击提交表单事件的按钮;如果form内含有submit按钮该参数可省略;
11		btnReset:".btn_reset",//可选项 .btn_reset是该表单下要绑定点击重置表单事件的按钮;
12		tiptype:1, //可选项 1=>pop box,2=>side tip(parent.next.find; with default pop),3=>side tip(siblings; with default pop),4=>side tip(siblings; none pop),默认为1,也可以传入一个function函数,自定义提示信息的显示方式(可以实现你想要的任何效果,具体参见demo页);
13		ignoreHidden:false,//可选项 true | false 默认为false,当为true时对:hidden的表单元素将不做验证;
14		dragonfly:false,//可选项 true | false 默认false,当为true时,值为空时不做验证;
15		tipSweep:true,//可选项 true | false 默认为false,只在表单提交时触发检测,blur事件将不会触发检测(实时验证会在后台进行,不会显示检测结果);
16		label:".label",//可选项 选择符,在没有绑定nullmsg时查找要显示的提示文字,默认查找".Validform_label"下的文字;
17		showAllError:false,//可选项 true | false,true:提交表单时所有错误提示信息都会显示,false:一碰到验证不通过的就停止检测后面的元素,只显示该元素的错误信息;
18		postonce:true, //可选项 表单是否只能提交一次,true开启,不填则默认关闭;
19		ajaxPost:true, //使用ajax方式提交表单数据,默认false,提交地址就是action指定地址;
20		datatype:{//传入自定义datatype类型,可以是正则,也可以是函数(函数内会传入一个参数);
21			"*6-20": /^[^\s]{6,20}$/,
22			"z2-4" : /^[\u4E00-\u9FA5\uf900-\ufa2d]{2,4}$/,
23			"username":function(gets,obj,curform,regxp){
24				//参数gets是获取到的表单元素值,obj为当前表单元素,curform为当前验证的表单,regxp为内置的一些正则表达式的引用;
25				var reg1=/^[\w\.]{4,16}$/,
26					reg2=/^[\u4E00-\u9FA5\uf900-\ufa2d]{2,8}$/;
27				
28				if(reg1.test(gets)){return true;}
29				if(reg2.test(gets)){return true;}
30				return false;
31				
32				//注意return可以返回true 或 false 或 字符串文字,true表示验证通过,返回字符串表示验证失败,字符串作为错误提示显示,返回false则用errmsg或默认的错误提示;
33			},
34			"phone":function(){
35				// 5.0 版本之后,要实现二选一的验证效果,datatype 的名称 不 需要以 "option_" 开头;	
36			}
37		},
38		usePlugin:{
39			swfupload:{},
40			datepicker:{},
41			passwordstrength:{},
42			jqtransform:{
43				selector:"select,input"
44			}
45		},
46		beforeCheck:function(curform){
47			//在表单提交执行验证之前执行的函数,curform参数是当前表单对象。
48			//这里明确return false的话将不会继续执行验证操作;	
49		},
50		beforeSubmit:function(curform){
51			//在验证成功后,表单提交前执行的函数,curform参数是当前表单对象。
52			//这里明确return false的话表单将不会提交;	
53		},
54		callback:function(data){
55			//返回数据data是json格式,{"info":"demo info","status":"y"}
56			//info: 输出提示信息;
57			//status: 返回提交数据的状态,是否提交成功。如可以用"y"表示提交成功,"n"表示提交失败,在ajax_post.php文件返回数据里自定字符,主要用在callback函数里根据该值执行相应的回调操作;
58			//你也可以在ajax_post.php文件返回更多信息在这里获取,进行相应操作;
59			//ajax遇到服务端错误时也会执行回调,这时的data是{ status:**, statusText:**, readyState:**, responseText:** };
60			
61			//这里执行回调操作;
62			//注意:如果不是ajax方式提交表单,传入callback,这时data参数是当前表单对象,回调函数会在表单验证全部通过后执行,然后判断是否提交表单,如果callback里明确return false,则表单不会提交,如果return true或没有return,则会提交表单。
63		}
64	});
65	
66	Validform对象的方法和属性:
67	tipmsg:自定义提示信息,通过修改Validform对象的这个属性值来让同一个页面的不同表单使用不同的提示文字;
68	dataType:获取内置的一些正则;
69	eq(n):获取Validform对象的第n个元素;
70	ajaxPost(flag,sync,url):以ajax方式提交表单。flag为true时,跳过验证直接提交,sync为true时将以同步的方式进行ajax提交,传入了url地址时,表单会提交到这个地址;
71	abort():终止ajax的提交;
72	submitForm(flag,url):以参数里设置的方式提交表单,flag为true时,跳过验证直接提交,传入了url地址时,表单会提交到这个地址;
73	resetForm():重置表单;
74	resetStatus():重置表单的提交状态。传入了postonce参数的话,表单成功提交后状态会设置为"posted",重置提交状态可以让表单继续可以提交;
75	getStatus():获取表单的提交状态,normal:未提交,posting:正在提交,posted:已成功提交过;
76	setStatus(status):设置表单的提交状态,可以设置normal,posting,posted三种状态,不传参则设置状态为posting,这个状态表单可以验证,但不能提交;
77	ignore(selector):忽略对所选择对象的验证;
78	unignore(selector):将ignore方法所忽略验证的对象重新获取验证效果;
79	addRule(rule):可以通过Validform对象的这个方法来给表单元素绑定验证规则;
80	check(bool,selector):对指定对象进行验证(默认验证当前整个表单),通过返回true,否则返回false(绑定实时验证的对象,格式符合要求时返回true,而不会等ajax的返回结果),bool为true时则只验证不显示提示信息;
81	config(setup):可以通过这个方法来修改初始化参数,指定表单的提交地址,给表单ajax和实时
81验证的ajax里设置参数;
82*/
83
84(function($,win,undef){
85	var errorobj=null,//指示当前验证失败的表单元素;
86		msgobj=null,//pop box object 
87		msghidden=true;//msgbox hidden?
88
89	var tipmsg={//默认提示文字;
90		tit:"提示信息",
91		w:{
92			"*":"不能为空!",
93			"*6-16":"请填写6到16位任意字符!",
94			"n":"请填写数字!",
95			"n6-16":"请填写6到16位数字!",
96			"s":"不能输入特殊字符!",
97			"s6-18":"请填写6到18位字符!",
98			"p":"请填写邮政编码!",
99			"m":"请填写手机号码!",
100			"e":"邮箱地址格式不对!",
101			"url":"请填写网址!"
102		},
103		def:"请填写正确信息!",
104		undef:"datatype未定义!",
105		reck:"两次输入的内容不一致!",
106		r:"",
107		c:"正在检测信息…",
108		s:"请{填写|选择}{0|信息}!",
109		v:"所填信息没有经过验证,请稍后…",
110		p:"正在提交数据…"
111	}
112	$.Tipmsg=tipmsg;
113	
114	var Validform=function(forms,settings,inited){
115		var settings=$.extend({},Validform.defaults,settings);
116		settings.datatype && $.extend(Validform.util.dataType,settings.datatype);
117		
118		var brothers=this;
119		brothers.tipmsg={w:{}};
120		brothers.forms=forms;
121		brothers.objects=[];
122		
123		//创建子对象时不再绑定事件;
124		if(inited===true){
125			return false;
126		}
127		
128		forms.each(function(){
129			//已经绑定事件时跳过,避免事件重复绑定;
130			if(this.validform_inited=="inited"){return true;}
131			this.validform_inited="inited";
132			
133			var curform=this;
134			curform.settings=$.extend({},settings);
135			
136			var $this=$(curform);
137			
138			//防止表单按钮双击提交两次;
139			curform.validform_status="normal"; //normal | posting | posted;
140			
141			//让每个Validform对象都能自定义tipmsg;	
142			$this.data("tipmsg",brothers.tipmsg);
143
144			//bind the blur event;
145			$this.delegate("[datatype]","blur",function(){
146				//判断是否是在提交表单操作时触发的验证请求;
147				var subpost=arguments[1];
148				Validform.util.check.call(this,$this,subpost);
149				
150			});
151			
152			$this.delegate(":text","keypress",function(event){
153				if(event.keyCode==13 && $this.find(":submit").length==0){
154					$this.submit();
155				}
156			});
157			
158			//点击表单元素,默认文字消失效果;
159			//表单元素值比较时的信息提示增强;
160			//radio、checkbox提示信息增强;
161			//外调插件初始化;
162			Validform.util.enhance.call($this,curform.settings.tiptype,curform.settings.usePlugin,curform.settings.tipSweep);
163			
164			curform.settings.btnSubmit && $this.find(curform.settings.btnSubmit).bind("click",function(){
165				$this.trigger("submit");
166				return false;
167			});
168						
169			$this.submit(function(){
170				var subflag=Validform.util.submitForm.call($this,curform.settings);
171				subflag === undef && (subflag=true);
172				return subflag;
173			});
174			
175			$this.find("[type='reset']").add($this.find(curform.settings.btnReset)).bind("click",function(){
176				Validform.util.resetForm.call($this);
177			});
178			
179		});
180		
181		//预创建pop box;
182		if( settings.tiptype==1 || (settings.tiptype==2 || settings.tiptype==3) && settings.ajaxPost ){		
183			creatMsgbox();
184		}
185	}
186	
187	Validform.defaults={
188		tiptype:1,
189		tipSweep:false,
190		showAllError:false,
191		postonce:false,
192		ajaxPost:false
193	}
194	
195	Validform.util={
196		dataType:{
197			"*":/[\w\W]+/,
198			"*6-16":/^[\w\W]{6,16}$/,
199			"n":/^\d+$/,
200			"n6-16":/^\d{6,16}$/,
201			"s":/^[\u4E00-\u9FA5\uf900-\ufa2d\w\.\s]+$/,
202			"s6-18":/^[\u4E00-\u9FA5\uf900-\ufa2d\w\.\s]{6,18}$/,
203			"p":/^[0-9]{6}$/,
204			"m":/^1(3|4|5|6|7|8|9)\d{9}$/,
205			"e":/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
206			"url":/^(\w+:\/\/)?\w+(\.\w+)+.*$/
207		},
208		
209		toString:Object.prototype.toString,
210		
211		isEmpty:function(val){
212			return val==="" || val===$.trim(this.attr("tip"));
213		},
214		
215		getValue:function(obj){
216			var inputval,
217				curform=this;
218				
219			if(obj.is(":radio")){
220				inputval=curform.find(":radio[name='"+obj.attr("name")+"']:checked").val();
221				inputval= inputval===undef ? "" : inputval;
222			}else if(obj.is(":checkbox")){
223				inputval="";
224				curform.find(":checkbox[name='"+obj.attr("name")+"']:checked").each(function(){ 
225					inputval +=$(this).val()+','; 
226				})
227				inputval= inputval===undef ? "" : inputval;
228			}else{
229				inputval=obj.val();
230			}
231			inputval=$.trim(inputval);
232			
233			return Validform.util.isEmpty.call(obj,inputval) ? "" : inputval;
234		},
235		
236		enhance:function(tiptype,usePlugin,tipSweep,addRule){
237			var curform=this;
238			
239			//页面上不存在提示信息的标签时,自动创建;
240			curform.find("[datatype]").each(function(){
241				if(tiptype==2){
242					if($(this).parents(".formControls").next().find(".Validform_checktip").length==0){
243						$(this).parents(".formControls").next().append("<span class='Validform_checktip' />");
244						$(this).siblings(".Validform_checktip").remove();
245					}
246				}else if(tiptype==3 || tiptype==4){
247					if($(this).siblings(".Validform_checktip").length==0){
248						$(this).parent().append("<span class='Validform_checktip' />");
249						$(this).parent().next().find(".Validform_checktip").remove();
250						$(this).parents(".formControls").next().find(".Validform_checktip").remove();
251					}
252				}
253			})
254			
255			//表单元素值比较时的信息提示增强;
256			curform.find("input[recheck]").each(function(){
257				//已经绑定事件时跳过;
258				if(this.validform_inited=="inited"){return true;}
259				this.validform_inited="inited";
260				
261				var _this=$(this);
262				var recheckinput=curform.find("input[name='"+$(this).attr("recheck")+"']");
263				recheckinput.bind("keyup",function(){
264					if(recheckinput.val()==_this.val() && recheckinput.val() != ""){
265						if(recheckinput.attr("tip")){
266							if(recheckinput.attr("tip") == recheckinput.val()){return false;}
267						}
268						_this.trigger("blur");
269					}
270				}).bind("blur",function(){
271					if(recheckinput.val()!=_this.val() && _this.val()!=""){
272						if(_this.attr("tip")){
273							if(_this.attr("tip") == _this.val()){return false;}	
274						}
275						_this.trigger("blur");
276					}
277				});
278			});
279			
280			//hasDefaultText;
281			curform.find("[tip]").each(function(){//tip是表单元素的默认提示信息,这是点击清空效果;
282				//已经绑定事件时跳过;
283				if(this.validform_inited=="inited"){return true;}
284				this.validform_inited="inited";
285				
286				var defaultvalue=$(this).attr("tip");
287				var altercss=$(this).attr("altercss");
288				$(this).focus(function(){
289					if($(this).val()==defaultvalue){
290						$(this).val('');
291						if(altercss){$(this).removeClass(altercss);}
292					}
293				}).blur(function(){
294					if($.trim($(this).val())===''){
295						$(this).val(defaultvalue);
296						if(altercss){$(this).addClass(altercss);}
297					}
298				});
299			});
300			
301			//enhance info feedback for checkbox & radio;
302			curform.find(":checkbox[datatype],:radio[datatype]").each(function(){
303				//已经绑定事件时跳过;
304				if(this.validform_inited=="inited"){return true;}
305				this.validform_inited="inited";
306				
307				var _this=$(this);
308				var name=_this.attr("name");
309				curform.find("[name='"+name+"']").filter(":checkbox,:radio").bind("click",function(){
310					//避免多个事件绑定时的取值滞后问题;
311					setTimeout(function(){
312						_this.trigger("blur");
313					},0);
314				});
315				
316			});
317			
318			//select multiple;
319			curform.find("select[datatype][multiple]").bind("click",function(){
320				var _this=$(this);
321				setTimeout(function(){
322					_this.trigger("blur");
323				},0);
324			});
325			
326			//plugins here to start;
327			Validform.util.usePlugin.call(curform,usePlugin,tiptype,tipSweep,addRule);
328		},
329		
330		usePlugin:function(plugin,tiptype,tipSweep,addRule){
331			/*
332				plugin:settings.usePlugin;
333				tiptype:settings.tiptype;
334				tipSweep:settings.tipSweep;
335				addRule:是否在addRule时触发;
336			*/
337
338			var curform=this,
339				plugin=plugin || {};
340			//swfupload;
341			if(curform.find("input[plugin='swfupload']").length && typeof(swfuploadhandler) != "undefined"){
342				
343				var custom={
344						custom_settings:{
345							form:curform,
346							showmsg:function(msg,type,obj){
347								Validform.util.showmsg.call(curform,msg,tiptype,{obj:curform.find("input[plugin='swfupload']"),type:type,sweep:tipSweep});	
348							}	
349						}	
350					};
351
352				custom=$.extend(true,{},plugin.swfupload,custom);
353				
354				curform.find("input[plugin='swfupload']").each(function(n){
355					if(this.validform_inited=="inited"){return true;}
356					this.validform_inited="inited";
357					
358					$(this).val("");
359					swfuploadhandler.init(custom,n);
360				});
361				
362			}
363			
364			//datepicker;
365			if(curform.find("input[plugin='datepicker']").length && $.fn.datePicker){
366				plugin.datepicker=plugin.datepicker || {};
367				
368				if(plugin.datepicker.format){
369					Date.format=plugin.datepicker.format; 
370					delete plugin.datepicker.format;
371				}
372				if(plugin.datepicker.firstDayOfWeek){
373					Date.firstDayOfWeek=plugin.datepicker.firstDayOfWeek; 
374					delete plugin.datepicker.firstDayOfWeek;
375				}
376
377				curform.find("input[plugin='datepicker']").each(function(n){
378					if(this.validform_inited=="inited"){return true;}
379					this.validform_inited="inited";
380					
381					plugin.datepicker.callback && $(this).bind("dateSelected",function(){
382						var d=new Date( $.event._dpCache[this._dpId].getSelected()[0] ).asString(Date.format);
383						plugin.datepicker.callback(d,this);
384					});
385					$(this).datePicker(plugin.datepicker);
386				});
387			}
388			
389			//passwordstrength;
390			if(curform.find("input[plugin*='passwordStrength']").length && $.fn.passwordStrength){
391				plugin.passwordstrength=plugin.passwordstrength || {};
392				plugin.passwordstrength.showmsg=function(obj,msg,type){
393					Validform.util.showmsg.call(curform,msg,tiptype,{obj:obj,type:type,sweep:tipSweep});
394				};
395				
396				curform.find("input[plugin='passwordStrength']").each(function(n){
397					if(this.validform_inited=="inited"){return true;}
398					this.validform_inited="inited";
399					
400					$(this).passwordStrength(plugin.passwordstrength);
401				});
402			}
403			
404			//jqtransform;
405			if(addRule!="addRule" && plugin.jqtransform && $.fn.jqTransSelect){
406				if(curform[0].jqTransSelected=="true"){return;};
407				curform[0].jqTransSelected="true";
408				
409				var jqTransformHideSelect = function(oTarget){
410					var ulVisible = $('.jqTransformSelectWrapper ul:visible');
411					ulVisible.each(function(){
412						var oSelect = $(this).parents(".jqTransformSelectWrapper:first").find("select").get(0);
413						//do not hide if click on the label object associated to the select
414						if( !(oTarget && oSelect.oLabel && oSelect.oLabel.get(0) == oTarget.get(0)) ){$(this).hide();}
415					});
416				};
417				
418				/* Check for an external click */
419				var jqTransformCheckExternalClick = function(event) {
420					if ($(event.target).parents('.jqTransformSelectWrapper').length === 0) { jqTransformHideSelect($(event.target)); }
421				};
422				
423				var jqTransformAddDocumentListener = function (){
424					$(document).mousedown(jqTransformCheckExternalClick);
425				};
426				
427				if(plugin.jqtransform.selector){
428					curform.find(plugin.jqtransform.selector).filter('input:submit, input:reset, input[type="button"]').jqTransInputButton();
429					curform.find(plugin.jqtransform.selector).filter('input:text, input:password').jqTransInputText();			
430					curform.find(plugin.jqtransform.selector).filter('input:checkbox').jqTransCheckBox();
431					curform.find(plugin.jqtransform.selector).filter('input:radio').jqTransRadio();
432					curform.find(plugin.jqtransform.selector).filter('textarea').jqTransTextarea();
433					if(curform.find(plugin.jqtransform.selector).filter("select").length > 0 ){
434						 curform.find(plugin.jqtransform.selector).filter("select").jqTransSelect();
435						 jqTransformAddDocumentListener();
436					}
437					
438				}else{
439					curform.jqTransform();
440				}
441				
442				curform.find(".jqTransformSelectWrapper").find("li a").click(function(){
443					$(this).parents(".jqTransformSelectWrapper").find("select").trigger("blur");	
444				});
445			}
446
447		},
448		
449		getNullmsg:function(curform){
450			var obj=this;
451			var reg=/[\u4E00-\u9FA5\uf900-\ufa2da-zA-Z\s]+/g;
452			var nullmsg;
453			
454			var label=curform[0].settings.label || ".Validform_label";
455			label=obj.siblings(label).eq(0).text() || obj.siblings().find(label).eq(0).text() || obj.parent().siblings(label).eq(0).text() || obj.parent().siblings().find(label).eq(0).text();
456			label=label.replace(/\s(?![a-zA-Z])/g,"").match(reg);
457			label=label? label.join("") : [""];
458
459			reg=/\{(.+)\|(.+)\}/;
460			nullmsg=curform.data("tipmsg").s || tipmsg.s;
461			
462			if(label != ""){
463				nullmsg=nullmsg.replace(/\{0\|(.+)\}/,label);
464				if(obj.attr("recheck")){
465					nullmsg=nullmsg.replace(/\{(.+)\}/,"");
466					obj.attr("nullmsg",nullmsg);
467					return nullmsg;
468				}
469			}else{
470				nullmsg=obj.is(":checkbox,:radio,select") ? nullmsg.replace(/\{0\|(.+)\}/,"") : nullmsg.replace(/\{0\|(.+)\}/,"$1");
471			}
472			nullmsg=obj.is(":checkbox,:radio,select") ? nullmsg.replace(reg,"$2") : nullmsg.replace(reg,"$1");
473			
474			obj.attr("nullmsg",nullmsg);
475			return nullmsg;
476		},
477		
478		getErrormsg:function(curform,datatype,recheck){
479			var regxp=/^(.+?)((\d+)-(\d+))?$/,
480				regxp2=/^(.+?)(\d+)-(\d+)$/,
481				regxp3=/(.*?)\d+(.+?)\d+(.*)/,
482				mac=datatype.match(regxp),
483				temp,str;
484			
485			//如果是值不一样而报错;
486			if(recheck=="recheck"){
487				str=curform.data("tipmsg").reck || tipmsg.reck;
488				return str;
489			}
490			
491			var tipmsg_w_ex=$.extend({},tipmsg.w,curform.data("tipmsg").w);
492			
493			//如果原来就有,直接显示该项的提示信息;
494			if(mac[0] in tipmsg_w_ex){
495				return curform.data("tipmsg").w[mac[0]] || tipmsg.w[mac[0]];
496			}
497			
498			//没有的话在提示对象里查找相似;
499			for(var name in tipmsg_w_ex){
500				if(name.indexOf(mac[1])!=-1 && regxp2.test(name)){
501					str=(curform.data("tipmsg").w[name] || tipmsg.w[name]).replace(regxp3,"$1"+mac[3]+"$2"+mac[4]+"$3");
502					curform.data("tipmsg").w[mac[0]]=str;
503					
504					return str;
505				}
506				
507			}
508			
509			return curform.data("tipmsg").def || tipmsg.def;
510		},
511
512		_regcheck:function(datatype,gets,obj,curform){
513			var curform=curform,
514				info=null,
515				passed=false,
516				reg=/\/.+\//g,
517				regex=/^(.+?)(\d+)-(\d+)$/,
518				type=3;//default set to wrong type, 2,3,4;
519				
520			//datatype有三种情况:正则,函数和直接绑定的正则;
521			
522			//直接是正则;
523			if(reg.test(datatype)){
524				var regstr=datatype.match(reg)[0].slice(1,-1);
525				var param=datatype.replace(reg,"");
526				var rexp=RegExp(regstr,param);
527
528				passed=rexp.test(gets);
529
530			//function;
531			}else if(Validform.util.toString.call(Validform.util.dataType[datatype])=="[object Function]"){
532				passed=Validform.util.dataType[datatype](gets,obj,curform,Validform.util.dataType);
533				if(passed === true || passed===undef){
534					passed = true;
535				}else{
536					info= passed;
537					passed=false;
538				}
539			
540			//自定义正则;	
541			}else{
542				//自动扩展datatype;
543				if(!(datatype in Validform.util.dataType)){
544					var mac=datatype.match(regex),
545						temp;
546						
547					if(!mac){
548						passed=false;
549						info=curform.data("tipmsg").undef||tipmsg.undef;
550					}else{
551						for(var name in Validform.util.dataType){
552							temp=name.match(regex);
553							if(!temp){continue;}
554							if(mac[1]===temp[1]){
555								var str=Validform.util.dataType[name].toString(),
556									param=str.match(/\/[mgi]*/g)[1].replace("\/",""),
557									regxp=new RegExp("\\{"+temp[2]+","+temp[3]+"\\}","g");
558								str=str.replace(/\/[mgi]*/g,"\/").replace(regxp,"{"+mac[2]+","+mac[3]+"}").replace(/^\//,"").replace(/\/$/,"");
559								Validform.util.dataType[datatype]=new RegExp(str,param);
560								break;
561							}	
562						}
563					}
564				}
565				
566				if(Validform.util.toString.call(Validform.util.dataType[datatype])=="[object RegExp]"){
567					passed=Validform.util.dataType[datatype].test(gets);
568				}
569					
570			}
571			
572			
573			if(passed){
574				type=2;
575				info=obj.attr("sucmsg") || curform.data("tipmsg").r||tipmsg.r;
576				
577				//规则验证通过后,还需要对绑定recheck的对象进行值比较;
578				if(obj.attr("recheck")){
579					var theother=curform.find("input[name='"+obj.attr("recheck")+"']:first");
580					if(gets!=theother.val()){
581						passed=false;
582						type=3;
583						info=obj.attr("errormsg")  || Validform.util.getErrormsg.call(obj,curform,datatype,"recheck");
584					}
585				}
586			}else{
587				info=info || obj.attr("errormsg") || Validform.util.getErrormsg.call(obj,curform,datatype);
588				
589				//验证不通过且为空时;
590				if(Validform.util.isEmpty.call(obj,gets)){
591					info=obj.attr("nullmsg") || Validform.util.getNullmsg.call(obj,curform);
592				}
593			}
594			
595			return{
596					passed:passed,
597					type:type,
598					info:info
599			};
600			
601		},
602		
603		regcheck:function(datatype,gets,obj){
604			/*
605				datatype:datatype;
606				gets:inputvalue;
607				obj:input object;
608			*/
609			var curform=this,
610				info=null,
611				passed=false,
612				type=3;//default set to wrong type, 2,3,4;
613				
614			//ignore;
615			if(obj.attr("ignore")==="ignore" && Validform.util.isEmpty.call(obj,gets)){				
616				if(obj.data("cked")){
617					info="";	
618				}
619				
620				return {
621					passed:true,
622					type:4,
623					info:info
624				};
625			}
626
627			obj.data("cked","cked");//do nothing if is the first time validation triggered;
628			
629			var dtype=Validform.util.parseDatatype(datatype);
630			var res;
631			for(var eithor=0; eithor<dtype.length; eithor++){
632				for(var dtp=0; dtp<dtype[eithor].length; dtp++){
633					res=Validform.util._regcheck(dtype[eithor][dtp],gets,obj,curform);
634					if(!res.passed){
635						break;
636					}
637				}
638				if(res.passed){
639					break;
640				}
641			}
642			return res;
643			
644		},
645		
646		parseDatatype:function(datatype){
647			/*
648				字符串里面只能含有一个正则表达式;
649				Datatype名称必须是字母,数字、下划线或*号组成;
650				datatype="/regexp/|phone|tel,s,e|f,e";
651				==>[["/regexp/"],["phone"],["tel","s","e"],["f","e"]];
652			*/
653
654			var reg=/\/.+?\/[mgi]*(?=(,|$|\||\s))|[\w\*-]+/g,
655				dtype=datatype.match(reg),
656				sepor=datatype.replace(reg,"").replace(/\s*/g,"").split(""),
657				arr=[],
658				m=0;
659				
660			arr[0]=[];
661			arr[0].push(dtype[0]);
662			for(var n=0;n<sepor.length;n++){
663				if(sepor[n]=="|"){
664					m++;
665					arr[m]=[];
666				}
667				arr[m].push(dtype[n+1]);
668			}
669			
670			return arr;
671		},
672
673		showmsg:function(msg,type,o,triggered){
674			/*
675				msg:提示文字;
676				type:提示信息显示方式;
677				o:{obj:当前对象, type:1=>正在检测 | 2=>通过, sweep:true | false}, 
678				triggered:在blur或提交表单触发的验证中,有些情况不需要显示提示文字,如自定义弹出提示框的显示方式,不需要每次blur时就马上弹出提示;
679				
680				tiptype:1\2\3时都有坑能会弹出自定义提示框
681				tiptype:1时在triggered bycheck时不弹框
682				tiptype:2\3时在ajax时弹框
683				tipSweep为true时在triggered bycheck时不触发showmsg,但ajax出错的情况下要提示
684			*/
685			
686			//如果msg为undefined,那么就没必要执行后面的操作,ignore有可能会出现这情况;
687			if(msg==undef){return;}
688			
689			//tipSweep为true,且当前不是处于错误状态时,blur事件不触发信息显示;
690			if(triggered=="bycheck" && o.sweep && (o.obj && !o.obj.is(".Validform_error") || typeof type == "function")){return;}
691
692			$.extend(o,{curform:this});
693				
694			if(typeof type == "function"){
695				type(msg,o,Validform.util.cssctl);
696				return;
697			}
698			
699			if(type==1 || triggered=="byajax" && type!=4){
700				msgobj.find(".Validform_info").html(msg);
701			}
702			
703			//tiptypt=1时,blur触发showmsg,验证是否通过都不弹框,提交表单触发的话,只要验证出错,就弹框;
704			if(type==1 && triggered!="bycheck" && o.type!=2 || triggered=="byajax" && type!=4){
705				msghidden=false;
706				msgobj.find(".iframe").css("height",msgobj.outerHeight());
707				msgobj.show();
708				setCenter(msgobj,100);
709			}
710
711			if(type==2 && o.obj){
712				o.obj.parents(".formControls").next().find(".Validform_checktip").html(msg);
713				Validform.util.cssctl(o.obj.parents(".formControls").next().find(".Validform_checktip"),o.type);
714			}
715			
716			if((type==3 || type==4) && o.obj){
717				o.obj.siblings(".Validform_checktip").html(msg);
718				Validform.util.cssctl(o.obj.siblings(".Validform_checktip"),o.type);
719			}
720
721		},
722
723		cssctl:function(obj,status){
724			switch(status){
725				case 1:
726					obj.removeClass("Validform_right Validform_wrong").addClass("Validform_checktip Validform_loading");//checking;
727					break;
728				case 2:
729					obj.removeClass("Validform_wrong Validform_loading").addClass("Validform_checktip Validform_right");//passed;
730					break;
731				case 4:
732					obj.removeClass("Validform_right Validform_wrong Validform_loading").addClass("Validform_checktip");//for ignore;
733					break;
734				default:
735					obj.removeClass("Validform_right Validform_loading").addClass("Validform_checktip Validform_wrong");//wrong;
736			}
737		},
738		
739		check:function(curform,subpost,bool){
740			/*
741				检测单个表单元素;
742				验证通过返回true,否则返回false、实时验证返回值为ajax;
743				bool,传入true则只检测不显示提示信息;
744			*/
745			var settings=curform[0].settings;
746			var subpost=subpost || "";
747			var inputval=Validform.util.getValue.call(curform,$(this));
748			
749			//隐藏或绑定dataIgnore的表单对象不做验证;
750			if(settings.ignoreHidden && $(this).is(":hidden") || $(this).data("dataIgnore")==="dataIgnore"){
751				return true;
752			}
753			
754			//dragonfly=true时,没有绑定ignore,值为空不做验证,但验证不通过;
755			if(settings.dragonfly && !$(this).data("cked") && Validform.util.isEmpty.call($(this),inputval) && $(this).attr("ignore")!="ignore"){
756				return false;
757			}
758			
759			var flag=Validform.util.regcheck.call(curform,$(this).attr("datatype"),inputval,$(this));
760			
761			//值没变化不做检测,这时要考虑recheck情况;
762			//不是在提交表单时触发的ajax验证;
763			if(inputval==this.validform_lastval && !$(this).attr("recheck") && subpost==""){
764				return flag.passed ? true : false;
765			}
766
767			this.validform_lastval=inputval;//存储当前值;
768			
769			var _this;
770			errorobj=_this=$(this);
771			
772			if(!flag.passed){
773				//取消正在进行的ajax验证;
774				Validform.util.abort.call(_this[0]);
775				
776				if(!bool){
777					//传入"bycheck",指示当前是check方法里调用的,当tiptype=1时,blur事件不让触发错误信息显示;
778					Validform.util.showmsg.call(curform,flag.info,settings.tiptype,{obj:$(this),type:flag.type,sweep:settings.tipSweep},"bycheck");
779					
780					!settings.tipSweep && _this.addClass("Validform_error");
781				}
782				return false;
783			}
784			
785			//验证通过的话,如果绑定有ajaxurl,要执行ajax检测;
786			//当ignore="ignore"时,为空值可以通过验证,这时不需要ajax检测;
787			var ajaxurl=$(this).attr("ajaxurl");
788			if(ajaxurl && !Validform.util.isEmpty.call($(this),inputval) && !bool){
789				var inputobj=$(this);
790
791				//当提交表单时,表单中的某项已经在执行ajax检测,这时需要让该项ajax结束后继续提交表单;
792				if(subpost=="postform"){
793					inputobj[0].validform_subpost="postform";
794				}else{
795					inputobj[0].validform_subpost="";
796				}
797				
798				if(inputobj[0].validform_valid==="posting" && inputval==inputobj[0].validform_ckvalue){return "ajax";}
799				
800				inputobj[0].validform_valid="posting";
801				inputobj[0].validform_ckvalue=inputval;
802				Validform.util.showmsg.call(curform,curform.data("tipmsg").c||tipmsg.c,settings.tiptype,{obj:inputobj,type:1,sweep:settings.tipSweep},"bycheck");
803				
804				Validform.util.abort.call(_this[0]);
805				
806				var ajaxsetup=$.extend(true,{},settings.ajaxurl || {});
807								
808				var localconfig={
809					type: "POST",
810					cache:false,
811					url: ajaxurl,
812					data: "param="+encodeURIComponent(inputval)+"&name="+encodeURIComponent($(this).attr("name")),
813					success: function(data){
814						if($.trim(data.status)==="y"){
815							inputobj[0].validform_valid="true";
816							data.info && inputobj.attr("sucmsg",data.info);
817							Validform.util.showmsg.call(curform,inputobj.attr("sucmsg") || curform.data("tipmsg").r||tipmsg.r,settings.tiptype,{obj:inputobj,type:2,sweep:settings.tipSweep},"bycheck");
818							_this.removeClass("Validform_error");
819							errorobj=null;
820							if(inputobj[0].validform_subpost=="postform"){
821								curform.trigger("submit");
822							}
823						}else{
824							inputobj[0].validform_valid=data.info;
825							Validform.util.showmsg.call(curform,data.info,settings.tiptype,{obj:inputobj,type:3,sweep:settings.tipSweep});
826							_this.addClass("Validform_error");
827						}
828						_this[0].validform_ajax=null;
829					},
830					error: function(data){
831						if(data.status=="200"){
832							if(data.responseText=="y"){
833								ajaxsetup.success({"status":"y"});
834							}else{
835								ajaxsetup.success({"status":"n","info":data.responseText});	
836							}
837							return false;
838						}
839						
840						//正在检测时,要检测的数据发生改变,这时要终止当前的ajax。不是这种情况引起的ajax错误,那么显示相关错误信息;
841						if(data.statusText!=="abort"){
842							var msg="status: "+data.status+"; statusText: "+data.statusText;
843						
844							Validform.util.showmsg.call(curform,msg,settings.tiptype,{obj:inputobj,type:3,sweep:settings.tipSweep});
845							_this.addClass("Validform_error");
846						}
847						
848						inputobj[0].validform_valid=data.statusText;
849						_this[0].validform_ajax=null;
850						
851						//localconfig.error返回true表示还需要执行temp_err;
852						return true;
853					}
854				}
855				
856				if(ajaxsetup.success){
857					var temp_suc=ajaxsetup.success;
858					ajaxsetup.success=function(data){
859						localconfig.success(data);
860						temp_suc(data,inputobj);
861					}
862				}
863				
864				if(ajaxsetup.error){
865					var temp_err=ajaxsetup.error;
866					ajaxsetup.error=function(data){
867						//localconfig.error返回false表示不需要执行temp_err;
868						localconfig.error(data) && temp_err(data,inputobj);
869					}	
870				}
871
872				ajaxsetup=$.extend({},localconfig,ajaxsetup,{dataType:"json"});
873				_this[0].validform_ajax=$.ajax(ajaxsetup);
874				
875				return "ajax";
876			}else if(ajaxurl && Validform.util.isEmpty.call($(this),inputval)){
877				Validform.util.abort.call(_this[0]);
878				_this[0].validform_valid="true";
879			}
880			
881			if(!bool){
882				Validform.util.showmsg.call(curform,flag.info,settings.tiptype,{obj:$(this),type:flag.type,sweep:settings.tipSweep},"bycheck");
883				_this.removeClass("Validform_error");
884			}
885			errorobj=null;
886			
887			return true;
888		
889		},
890		
891		submitForm:function(settings,flg,url,ajaxPost,sync){
892			/*
893				flg===true时跳过验证直接提交;
894				ajaxPost==="ajaxPost"指示当前表单以ajax方式提交;
895			*/
896			var curform=this;
897			
898			//表单正在提交时点击提交按钮不做反应;
899			if(curform[0].validform_status==="posting"){return false;}
900			
901			//要求只能提交一次时;
902			if(settings.postonce && curform[0].validform_status==="posted"){return false;}
903			
904			var beforeCheck=settings.beforeCheck && settings.beforeCheck(curform);
905			if(beforeCheck===false){return false;}
906			
907			var flag=true,
908				inflag;
909				
910			curform.find("[datatype]").each(function(){
911				//跳过验证;
912				if(flg){
913					return false;
914				}
915				
916				//隐藏或绑定dataIgnore的表单对象不做验证;
917				if(settings.ignoreHidden && $(this).is(":hidden") || $(this).data("dataIgnore")==="dataIgnore"){
918					return true;
919				}
920				
921				var inputval=Validform.util.getValue.call(curform,$(this)),
922					_this;
923				errorobj=_this=$(this);
924				
925				inflag=Validform.util.regcheck.call(curform,$(this).attr("datatype"),inputval,$(this));
926				
927				if(!inflag.passed){
928					Validform.util.showmsg.call(curform,inflag.info,settings.tiptype,{obj:$(this),type:inflag.type,sweep:settings.tipSweep});
929					_this.addClass("Validform_error");
930					
931					if(!settings.showAllError){
932						_this.focus();
933						flag=false;
934						return false;
935					}
936					
937					flag && (flag=false);
938					return true;
939				}
940				
941				//当ignore="ignore"时,为空值可以通过验证,这时不需要ajax检测;
942				if($(this).attr("ajaxurl") && !Validform.util.isEmpty.call($(this),inputval)){
943					if(this.validform_valid!=="true"){
944						var thisobj=$(this);
945						Validform.util.showmsg.call(curform,curform.data("tipmsg").v||tipmsg.v,settings.tiptype,{obj:thisobj,type:3,sweep:settings.tipSweep});
946						_this.addClass("Validform_error");
947						
948						thisobj.trigger("blur",["postform"]);//continue the form post;
949						
950						if(!settings.showAllError){
951							flag=false;
952							return false;
953						}
954						
955						flag && (flag=false);
956						return true;
957					}
958				}else if($(this).attr("ajaxurl") && Validform.util.isEmpty.call($(this),inputval)){
959					Validform.util.abort.call(this);
960					this.validform_valid="true";
961				}
962
963				Validform.util.showmsg.call(curform,inflag.info,settings.tiptype,{obj:$(this),type:inflag.type,sweep:settings.tipSweep});
964				_this.removeClass("Validform_error");
965				errorobj=null;
966			});
967			
968			if(settings.showAllError){
969				curform.find(".Validform_error:first").focus();
970			}
971
972			if(flag){
973				var beforeSubmit=settings.beforeSubmit && settings.beforeSubmit(curform);
974				if(beforeSubmit===false){return false;}
975				
976				curform[0].validform_status="posting";
977							
978				if(settings.ajaxPost || ajaxPost==="ajaxPost"){
979					//获取配置参数;
980					var ajaxsetup=$.extend(true,{},settings.ajaxpost || {});
981					//有可能需要动态的改变提交地址,所以把action所指定的url层级设为最低;
982					ajaxsetup.url=url || ajaxsetup.url || settings.url || curform.attr("action");
983					
984					//byajax:ajax时,tiptye为1、2或3需要弹出提示框;
985					Validform.util.showmsg.call(curform,curform.data("tipmsg").p||tipmsg.p,settings.tiptype,{obj:curform,type:1,sweep:settings.tipSweep},"byajax");
986
987					//方法里的优先级要高;
988					//有undefined情况;
989					if(sync){
990						ajaxsetup.async=false;
991					}else if(sync===false){
992						ajaxsetup.async=true;
993					}
994					
995					if(ajaxsetup.success){
996						var temp_suc=ajaxsetup.success;
997						ajaxsetup.success=function(data){
998							settings.callback && settings.callback(data);
999							curform[0].validform_ajax=null;
1000							if($.trim(data.status)==="y"){
1001								curform[0].validform_status="posted";
1002							}else{
1003								curform[0].validform_status="normal";
1004							}
1005							
1006							temp_suc(data,curform);
1007						}
1008					}
1009					
1010					if(ajaxsetup.error){
1011						var temp_err=ajaxsetup.error;
1012						ajaxsetup.error=function(data){
1013							settings.callback && settings.callback(data);
1014							curform[0].validform_status="normal";
1015							curform[0].validform_ajax=null;
1016							
1017							temp_err(data,curform);
1018						}	
1019					}
1020					
1021					var localconfig={
1022						type: "POST",
1023						async:true,
1024						data: curform.serializeArray(),
1025						success: function(data){
1026							if($.trim(data.status)==="y"){
1027								//成功提交;
1028								curform[0].validform_status="posted";
1029								Validform.util.showmsg.call(curform,data.info,settings.tiptype,{obj:curform,type:2,sweep:settings.tipSweep},"byajax");
1030							}else{
1031								//提交出错;
1032								curform[0].validform_status="normal";
1033								Validform.util.showmsg.call(curform,data.info,settings.tiptype,{obj:curform,type:3,sweep:settings.tipSweep},"byajax");
1034							}
1035							
1036							settings.callback && settings.callback(data);
1037							curform[0].validform_ajax=null;
1038						},
1039						error: function(data){
1040							var msg="status: "+data.status+"; statusText: "+data.statusText;
1041									
1042							Validform.util.showmsg.call(curform,msg,settings.tiptype,{obj:curform,type:3,sweep:settings.tipSweep},"byajax");
1043							
1044							settings.callback && settings.callback(data);
1045							curform[0].validform_status="normal";
1046							curform[0].validform_ajax=null;
1047						}
1048					}
1049					
1050					ajaxsetup=$.extend({},localconfig,ajaxsetup,{dataType:"json"});
1051					
1052					curform[0].validform_ajax=$.ajax(ajaxsetup);
1053
1054				}else{
1055					if(!settings.postonce){
1056						curform[0].validform_status="normal";
1057					}
1058					
1059					var url=url || settings.url;
1060					if(url){
1061						curform.attr("action",url);
1062					}
1063					
1064					return settings.callback && settings.callback(curform);
1065				}
1066			}
1067			
1068			return false;
1069			
1070		},
1071		
1072		resetForm:function(){
1073			var brothers=this;
1074			brothers.each(function(){
1075				this.reset && this.reset();
1076				this.validform_status="normal";
1077			});
1078			
1079			brothers.find(".Validform_right").text("");
1080			brothers.find(".passwordStrength").children().removeClass("bgStrength");
1081			brothers.find(".Validform_checktip").removeClass("Validform_wrong Validform_right Validform_loading");
1082			brothers.find(".Validform_error").removeClass("Validform_error");
1083			brothers.find("[datatype]").removeData("cked").removeData("dataIgnore").each(function(){
1084				this.validform_lastval=null;
1085			});
1086			brothers.eq(0).find("input:first").focus();
1087		},
1088		
1089		abort:function(){
1090			if(this.validform_ajax){
1091				this.validform_ajax.abort();	
1092			}
1093		}
1094		
1095	}
1096	
1097	$.Datatype=Validform.util.dataType;
1098	
1099	Validform.prototype={
1100		dataType:Validform.util.dataType,
1101		
1102		eq:function(n){
1103			var obj=this;
1104			
1105			if(n>=obj.forms.length){
1106				return null;	
1107			}
1108			
1109			if(!(n in obj.objects)){
1110				obj.objects[n]=new Validform($(obj.forms[n]).get(),{},true);
1111			}
1112			
1113			return obj.objects[n];
1114
1115		},
1116		
1117		resetStatus:function(){
1118			var obj=this;
1119			$(obj.forms).each(function(){
1120				this.validform_status="normal";	
1121			});
1122			
1123			return this;
1124		},
1125		
1126		setStatus:function(status){
1127			var obj=this;
1128			$(obj.forms).each(function(){
1129				this.validform_status=status || "posting";	
1130			});
1131			
1132			return this;
1133		},
1134		
1135		getStatus:function(){
1136			var obj=this;
1137			var status=$(obj.forms)[0].validform_status;
1138			
1139			return status;
1140		},
1141		
1142		ignore:function(selector){
1143			var obj=this;
1144			var selector=selector || "[datatype]"
1145			
1146			$(obj.forms).find(selector).each(function(){
1147				$(this).data("dataIgnore","dataIgnore").removeClass("Validform_error");
1148			});
1149			
1150			return this;
1151		},
1152		
1153		unignore:function(selector){
1154			var obj=this;
1155			var selector=selector || "[datatype]"
1156			
1157			$(obj.forms).find(selector).each(function(){
1158				$(this).removeData("dataIgnore");
1159			});
1160			
1161			return this;
1162		},
1163		
1164		addRule:function(rule){
1165			/*
1166				rule => [{
1167					ele:"#id",
1168					datatype:"*",
1169					errormsg:"出错提示文字!",
1170					nullmsg:"为空时的提示文字!",
1171					tip:"默认显示的提示文字",
1172					altercss:"gray",
1173					ignore:"ignore",
1174					ajaxurl:"valid.php",
1175					recheck:"password",
1176					plugin:"passwordStrength"
1177				},{},{},...]
1178			*/
1179			var obj=this;
1180			var rule=rule || [];
1181			
1182			for(var index=0; index<rule.length; index++){
1183				var o=$(obj.forms).find(rule[index].ele);
1184				for(var attr in rule[index]){
1185					attr !=="ele" && o.attr(attr,rule[index][attr]);
1186				}
1187			}
1188			
1189			$(obj.forms).each(function(){
1190				var $this=$(this);
1191				Validform.util.enhance.call($this,this.settings.tiptype,this.settings.usePlugin,this.settings.tipSweep,"addRule");
1192			});
1193			
1194			return this;
1195		},
1196		
1197		ajaxPost:function(flag,sync,url){
1198			var obj=this;
1199			
1200			$(obj.forms).each(function(){
1201				//创建pop box;
1202				if( this.settings.tiptype==1 || this.settings.tiptype==2 || this.settings.tiptype==3 ){
1203					creatMsgbox();
1204				}
1205				
1206				Validform.util.submitForm.call($(obj.forms[0]),this.settings,flag,url,"ajaxPost",sync);
1207			});
1208			
1209			return this;
1210		},
1211		
1212		submitForm:function(flag,url){
1213			/*flag===true时不做验证直接提交*/
1214			
1215
1216			var obj=this;
1217			
1218			$(obj.forms).each(function(){
1219				var subflag=Validform.util.submitForm.call($(this),this.settings,flag,url);
1220				subflag === u
1220ndef && (subflag=true);
1221				if(subflag===true){
1222					this.submit();
1223				}
1224			});
1225			
1226			return this;
1227		},
1228		
1229		resetForm:function(){
1230			var obj=this;
1231			Validform.util.resetForm.call($(obj.forms));
1232			
1233			return this;
1234		},
1235		
1236		abort:function(){
1237			var obj=this;
1238			$(obj.forms).each(function(){
1239				Validform.util.abort.call(this);
1240			});
1241			
1242			return this;
1243		},
1244		
1245		check:function(bool,selector){
1246			/*
1247				bool:传入true,只检测不显示提示信息;
1248			*/
1249			
1250			var selector=selector || "[datatype]",
1251				obj=this,
1252				curform=$(obj.forms),
1253				flag=true;
1254			
1255			curform.find(selector).each(function(){
1256				Validform.util.check.call(this,curform,"",bool) || (flag=false);
1257			});
1258			
1259			return flag;
1260		},
1261		
1262		config:function(setup){
1263		/*
1264			config={
1265				url:"ajaxpost.php",//指定了url后,数据会提交到这个地址;
1266				ajaxurl:{
1267					timeout:1000,
1268					...
1269				},
1270				ajaxpost:{
1271					timeout:1000,
1272					...
1273				}
1274			}
1275		*/
1276			var obj=this;
1277			setup=setup || {};
1278			$(obj.forms).each(function(){
1279				var $this=$(this);
1280				this.settings=$.extend(true,this.settings,setup);
1281				Validform.util.enhance.call($this,this.settings.tiptype,this.settings.usePlugin,this.settings.tipSweep);
1282			});
1283			
1284			return this;
1285		}
1286	}
1287
1288	$.fn.Validform=function(settings){
1289		return new Validform(this,settings);
1290	};
1291	
1292	function setCenter(obj,time){
1293		var left=($(window).width()-obj.outerWidth())/2,
1294			top=($(window).height()-obj.outerHeight())/2,
1295			
1296		top=(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop)+(top>0?top:0);
1297
1298		obj.css({
1299			left:left
1300		}).animate({
1301			top : top
1302		},{ duration:time , queue:false });
1303	}
1304	
1305	function creatMsgbox(){
1306		if($("#Validform_msg").length!==0){return false;}
1307		msgobj=$('<div id="Validform_msg"><div class="Validform_title">'+tipmsg.tit+'<a class="Validform_close" href="javascript:void(0);">&chi;</a></div><div class="Validform_info"></div><div class="iframe"><iframe frameborder="0" scrolling="no" height="100%" width="100%"></iframe></div></div>').appendTo("body");//提示信息框;
1308		msgobj.find("a.Validform_close").click(function(){
1309			msgobj.hide();
1310			msghidden=true;
1311			if(errorobj){
1312				errorobj.focus().addClass("Validform_error");
1313			}
1314			return false;
1315		}).focus(function(){this.blur();});
1316
1317		$(window).bind("scroll resize",function(){
1318			!msghidden && setCenter(msgobj,400);
1319		});
1320	};
1321	
1322	//公用方法显示&关闭信息提示框;
1323	$.Showmsg=function(msg){
1324		creatMsgbox();
1325		Validform.util.showmsg.call(win,msg,1,{});
1326	};
1327	
1328	$.Hidemsg=function(){
1329		msgobj.hide();
1330		msghidden=true;
1331	};
1332	
1333})(jQuery,window);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.