Q:2493441723

登录时的各种信息提示

<!--
$(document).ready(function()
{
	//checkSubmit
	$('#regUser').submit(function ()
	{
		if(!$('#agree').get(0).checked) {
			alert("你必须同意注册协议!");
			return false;
		}
		if($('#username').val()==""){
			$('#username').focus();
			alert("用户名不能为空!");
			return false;
		}
		if($('#userpassword').val()=="")
		{
			$('#userpassword').focus();
			alert("登陆密码不能为空!");
			return false;
		}

		if($('#repassword').val()!=$('#userpassword').val())
		{
			$('#repassword').focus();
			alert("两次密码不一致!");
			return false;
		}
		
		if($('#mobile').val()=="")
		{
			$('#mobile').focus();
			alert("手机号不能为空!");
			return false;
		}
		
		if($('#vdcode').val()=="")
		{
			$('#vdcode').focus();
			alert("验证码不能为空!");
			return false;
		}
	})
	//去除两边空格
		String.prototype.Trim   =   function()   
		{   
			return   this.replace(/^\s*|\s*$/g,"");   
		}
		
	//AJAX changChickValue
	$("#username").change( function() {
		var username = $("#username").val();
		var flag = 1;
		var c; 
		
		username = username.Trim();
		
		if((username.length!=0)&(username.length<6||username.length>20)){
			var str = "<font color='red'><b>×请使用6-20位做用户名!</b></font>";
			$("#_userid").html(str);
			$('#username').focus();
		}else{
			
			var letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_.@";
			 for(var i=0;i<username.length;i++){
				c = username.charAt(i);
				if(letters.indexOf( c ) < 0){
					flag = 3;
				}
			 }
		
			 if(flag==3){
				 
				 var str = "<font color='red'><b>×请使用数字字母下划线做用户名!</b></font>";
				 $("#_userid").html(str);
				 $('#username').focus();

			 }else{
				
				$.post("reg.php",
					   {dopost:'checkuser',cktype:1,uid:username},
					   function(data){
							$("#_userid").html(data);
					   }
				);
			 }
		 }
		 
		
	});
	//这幅弹出框的注册
	$("#username2").change( function() {
		var username = $("#username2").val();
		var flag = 1;
		var c; 
		var sEmail = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
		
		username = username.Trim();

		if((username.length!=0)&(username.length<6||username.length>20)){
			var str = "<font color='red'><b>×请使用6-20位做用户名!</b></font>";
			$("#_userid2").html(str);
			$('#username2').focus();
		}
		else{

			var letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_.@";
			for(var i=0;i<username.length;i++){
				c = username.charAt(i);
				if(letters.indexOf( c ) < 0){
					flag = 3;
				}
			}
			
			if(flag==3){

				var str = "<font color='red'><b>×请使用数字字母下划线做用户名!</b></font>";
				$("#_userid2").html(str);
				$('#username2').focus();

			}
			
				 
			if(!sEmail.exec($("#username2").val()))
			{
				$('#_userid2').html("<font color='red'><b>×Email格式不正确</b></font>");
				$('#username2').focus();
			}
			else{
				$.post("/reg/reg.php",{dopost:'checkmail',cktype:1,email:username},function(data){
				//alert(data);
					if(data == "<font color='#4E7504'><b>√可以使用</b></font>"){
					
						$.post("/reg/reg.php",{dopost:'checkuser',cktype:1,uid:username},function(data){$("#_userid2").html(data);});
					}else{
					$("#_userid2").html(data);
					}
					
					});
			}
		
	
				

		 }
		 
		
	});
	//这幅弹出框的注册  结束
	
	$("#email").change( function() {
		var sEmail = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
		var email = $("#email").val();
		if(!sEmail.exec($("#email").val()))
		{
			$('#_email').html("<font color='red'><b>×Email格式不正确</b></font>");
			$('#email').focus();
		}else{
			$.post("reg.php",
					{dopost:'checkmail',cktype:1,email:email},
					function(data){
						$("#_email").html(data);
					}
			);
		}
	});	
	
	$("#mobile").change(function(){

		var sMobile =/^1[3|4|5|8][0-9]\d{4,8}/;
		var mobile = $("#mobile").val();
		
		mobile = mobile.Trim();
	
		if(mobile.length==0){
			$('#_mobile').html("<font color ='red'><b>x手机号不能为空!</b></font>");
		}else{
			if(!sMobile.exec($("#mobile").val())){
				$('#_mobile').html("<font color ='red'><b>x手机号格式不正确</b></font>");
				$('#mobile').focus();
			}
			else{
					$('#_mobile').html("<font color='green'><b>√填写正确</b></font>");
			}
		}
	});
	$('#userpassword').change( function(){
		
		 if($('#userpassword').val()=='')
		{
			$('#_userpassword').html("<font color='red'><b>请填写密码</b></font>");
		}
		else if($('#userpassword').val().length < 6)
		{
			$('#_userpassword').html("<font color='red'><b>×密码不能小于6位</b></font>");
		}
		else if($('#userpassword').val().length > 20)
		{
			$('#_userpassword').html("<font color='red'><b>×密码不能大于20位</b></font>");
		}
		else
		{
			if($('#repassword').val().length>=6){
				if($('#repassword').val()!=$('#userpassword').val())
				{
					$('#_repassword').html("<font color='red'><b>×两次输入密码不一致</b></font>");
				}
			}
			$('#_userpassword').html("<font color='#4E7504'><b>√填写正确</b></font>");
		}
		
	});
	
	$('#repassword').change( function(){
		
		if($('#repassword').val()=='')
		{
			$('#_repassword').html("<font color='red'><b>请填写确认密码</b></font>");
		}
		else if($('#repassword').val().length <6)
		{
			$('#_repassword').html("<font color='red'><b>×密码不能小于6位</b></font>");
		}
		else if($('#repassword').val().length >20)
		{
			$('#_repassword').html("<font color='red'><b>×密码不能大于20位</b></font>");
		}
		else if($('#repassword').val()!=$('#userpassword').val())
		{
			$('#_repassword').html("<font color='red'><b>×两次输入密码不一致</b></font>");
		}
		else
		{
			
			$('#_repassword').html("<font color='#4E7504'><b>√填写正确</b></font>");
		}
		
	});
	

});
-->

  html部分

<script src="/templets/dujiaoshou/js/reg.js" type="text/javascript"></script>

  

<form id="regUser" name="form2" method="post" action="reg.php" target="_self">
<div class="mainBox_border1 clearfix area01">
<input type="hidden" name="dopost" value="save" />
	<!--<div class="liucheng01 mt10"></div>-->
    <table  cellspacing="0" cellpadding="0" border="0" class="zctab">
  <tbody>
  <tr>
    <td colspan="3">以下<span class="red">*</span>为必填项</td>
    </tr>
  <tr>
    <td width="162" class="textR"><span class="f14">用 户 名</span>:</td>
    <td width="188"><input type="text" name="username" id="username" class="txtInput"></td>
    <td width="350" class="color999" style="line-height:16px;"><span class="red">*</span><span id="_userid">6-20个字符(可以为字母、数字或下划线'_',不能包含空格),一旦注册成功用户名不能修改。</span></td>
	</tr>
  <tr>
    <td class="textR"><span class="f14">电子邮件</span>:</td>
    <td><input type="text"  name="email" id="email" class="txtInput"></td>
    <td valign="middle"><span class="red">*</span><span id="_email"></span></td>
  </tr>
  <tr>
    <td class="textR"><span class="f14">密      码</span>:</td>
    <td><input type="password"  name="userpassword" id="userpassword"  value="" class="txtInput"></td>
   <td valign="middle" class="color999"><span class="red">*</span><span id="_userpassword">6-20个字符(可以为字母、数字或下划线'_',不能包含空格)。</span></td>
  </tr>
  <tr>
    <td  class="textR"><span class="f14">密码确认</span>:</td>
    <td><input type="password"  name="repassword" id="repassword"  value="" class="txtInput"></td>
   <td valign="middle"><span class="red">*</span><span id="_repassword"></span></td>
  </tr>
  <tr>
    <td class="textR"><span class="f14">手机号码</span>:</td>
    <td><input type="text"  name="mobile" class="txtInput" id="mobile"></td>
    <td class="color999"><span class="red">*</span><span id="_mobile"></span></td>
  </tr>
  <tr>
    <td class="textR"><span class="f14">姓      名</span>:</td>
    <td><input type="text"  name="reusername" class="txtInput"></td>
  </tr>

  <tr>
    <td class="textR"><span class="f14">验 证 码</span>:</td>
    <td class="clearfix"><input type="text" name="vdcode" id="vdcode" value="" class="fl yxm"><!--img  name="imgCode" src="/templets/dujiaoshou/images/yzm.jpg" /-->
	 <img id="vdimgck" align="middle"  onclick="this.src=this.src+'?'"  style="cursor: pointer;" title="看不清?点击更换" src="../../include/vdimgck.php"/>
	</td>
   
    <td><span class="red">*</span>看不清?<a href="javascript:void(0)" target="_self" onclick="changeAuthCode()">换一张</a></td>
  </tr>

  

posted @ 2014-02-10 16:01  QQ2493441723  阅读(252)  评论(0编辑  收藏  举报