작업 항목

1590 단어 작업
function clsPassWordValidate(strPassWord)
		{
			this.passWord=strPassWord;
			this.errorTip=null;
			this.isSuccess=true;
			this.clsLengthValidate=clsPassWordValidate$clsLengthValidate;
			this.clsContentValidate=clsPassWordValidate$clsContentValidate;
			this.validate=clsPassWordValidate$validate;
			
		}
		function clsPassWordValidate$clsLengthValidate()
		{debugger;
			if(null==this.passWord)
			{
				this.isSuccess=false;
				this.errorTip=" !";
			}
			else 
			{
				if(this.passWord.length<1)
				{
					this.isSuccess=false;
					this.errorTip=" 1 !";							
				}		
			}
		}
	
	function clsPassWordValidate$clsContentValidate()
	{debugger;
		var btest=/[A-Za-z]/.test(this.passWord);
		
		if(!btest)
		{
			this.isSuccess=false;
			this.errorTip=" !";
		}		
		
		
		if(!this.isSuccess)
		{
			return;
		}
		
		btest=/[0-9]/.test(this.passWord);
		if(!btest)
		{
			this.isSuccess=false;
			this.errorTip=" !";
		}
		
		if(!this.isSuccess)
		{
			return;
		}
	

		btest=/[]\[\$~!@#%\^&\*\(\)_\+\{}\|:"<>\?`=\-\\;',\.\/]/.test(this.passWord);
		if(!btest)
		{
			this.isSuccess=false;
			this.errorTip=" !";

		}
		
		
	}
	
	function clsPassWordValidate$validate()
	{debugger;
		this.clsLengthValidate();
		if(this.isSuccess)
		{
			this.clsContentValidate();
		}
	
	}
	function test()
	{debugger;
		var str="helloworld";
		var oValidate=new clsPassWordValidate(str);
		oValidate.validate();
		if(!oValidate.isSuccess)
		{
			alert(oValidate.errorTip);
		
		}	
	}
	test();

좋은 웹페이지 즐겨찾기