正则手机 邮箱验证



function test(){ 
		var mp = /^(?:13\d|15[189])-?\d{5}(\d{3}|\*{3})$/; 
		var em = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
		 
		var mobilephone = document.getElementById("bean.mobilephone").value; 
		var email = document.getElementById("bean.email").value; 
		
		var err = "";
 
		if(mobilephone != ""){
			if (!mp.test(mobilephone)){
			 err += "请正确填写手机号码!\n";
			}
		} 
		if(email != ""){
			if (!em.test(email)){
			 err += "请填写正确的email地址!\n";
			}
		} 
 
	}

你可能感兴趣的:(bean)