`

jAlert() return 问题

 
阅读更多

校验正确通过写法

		if(cardCode==''){
		      jAlert('请选择通行卡','警告',function(){
		           j("#cardCode").focus();
		      });
		      return false;
		  }	 		
	    if(startDate==''){
		      jAlert('请选择卡的开始有效时间','警告',function(){
		           j("#startDate").focus();
		      });
		      return false;
		  }	

 

校验错误通过写法

		if(cardCode==''){
		      jAlert('请选择通行卡','警告',function(){
		           j("#cardCode").focus();
		           return false;
		      });
		  }	 		
	    if(startDate==''){
		      jAlert('请选择卡的开始有效时间','警告',function(){
		           j("#startDate").focus();
		           return false;
		      });
		  }	 

 

return false 写在里面后 假如 cardcode  和 startDate 都为空 ,第一个jAlert() 虽然起作用了,但是被第二个覆盖了,这是犯过的错误,jAlert内部原理还不是很了解

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics