function SFEC (){ var checkObject ={ succHtml : ""+ ""+ ""+ ""+ ""+ ""+ "
", failHtml : ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ "
"+ "{msg}
", tipHtml : ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ "
"+ "{msg}
", formCheck:'', checkResult:new Object(), setForm : function (formID){ var formObject=document.getElementById(formID); checkObject.formCheck=sinoApp.newFormCheck({ form : formObject, succ : function(spec) { //alert(spec.el.id+":success"); if(spec.el.type!='checkbox'&&spec.el.type!='radio'){ //spec.el.style.cssText=""; spec.el.className=spec.el.className.replace('fail_style','').replace('action_style',''); } spec.tip.innerHTML = checkObject.succHtml; checkObject.checkResult[spec.tip.id]=true; document.getElementById(spec.tip.id).setAttribute('tipresult',true); }, fail : function(spec) { //alert(spec.el.id+":fail"); if(spec.el.type!='checkbox'&&spec.el.type!='radio'){ //spec.el.style.cssText="background:#ffefe2;border:2px solid #ff6100;"; spec.el.className=spec.el.className.replace('action_style','').replace('fail_style',''); //alert(spec.el.className); //if(spec.el.className.indexof('fail_style')==-1){ spec.el.className=spec.el.className+' fail_style'; //alert(spec.el.className.indexOf('fail_style')); //} } spec.tip.innerHTML = checkObject.failHtml.replace(/\{msg\}/,spec.text); checkObject.checkResult[spec.tip.id]=false; document.getElementById(spec.tip.id).setAttribute('tipresult',false); }, inva : function(spec) { if(spec.el.type!='checkbox'&&spec.el.type!='radio'){ //spec.el.style.cssText=""; spec.el.className=spec.el.className.replace('fail_style','').replace('action_style','');; } spec.tip.innerHTML = ""; checkObject.checkResult[spec.tip.id]=true; document.getElementById(spec.tip.id).setAttribute('tipresult',true); }, focus: function(spec) { var text = spec.el.getAttribute('tipmsg'); var tip = document.getElementById(spec.el.getAttribute('tipid')); if( text && tip ) { if(spec.el.type!='checkbox'&&spec.el.type!='radio'){ //spec.el.style.cssText="background:#ddffda;border:2px solid #78cf81;"; spec.el.className=spec.el.className.replace('fail_style',''); spec.el.className=spec.el.className+' action_style'; } tip.innerHTML = checkObject.tipHtml.replace(/\{msg\}/,text); } //$("#result").empty(); }, click: function(spec) { var text = spec.el.getAttribute('tipmsg'); var tip = document.getElementById(spec.el.getAttribute('tipid')); if( text && tip ) { if(spec.el.type!='checkbox'&&spec.el.type!='radio'){ //spec.el.style.cssText="background:#ddffda;border:2px solid #78cf81;"; spec.el.className=spec.el.className.replace('fail_style',''); spec.el.className=spec.el.className+' action_style'; } tip.innerHTML = checkObject.tipHtml.replace(/\{msg\}/,text); } } }); }, start : function (){ checkObject.formCheck.start(); }, restart : function (){ checkObject.formCheck.restart(); }, /** 删除校验 **/ del : function (objID){ var obj=document.getElementById(objID); if(obj){ var tipid = obj.getAttribute('tipid'); var tipidObj = document.getElementById(tipid); if(tipidObj){ tipidObj.removeAttribute('tipresult'); if(checkObject.containsKey(tipid)){ delete checkObject.checkResult[tipid]; } } } }, /** 批量删除校验 **/ delBatch : function (objIDs){ //alert(objIDs); for(var i=0;i