日期:2014-05-16 浏览次数:20449 次
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs
/jquery/1.4.0/jquery.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>新用户注册</title>
<link rel="stylesheet" type="text/css" href="../CSS/style.css">
</head>
<body>
<div class="regist_step1"></div>
<script type="text/javascript">
var regname=/^[\w]+$/g;
$(document).ready(function(){
$("#1").blur(function()
{if(regname.test(this)=true)
{
$("#1tip").html("输入正确");
}
else
{$("#1").focus();
$("#1tip").html("用户名不能为空,\n且只能为2-16个数字或英文以及下划线组成的字符");
return false;}
;}
)
})
</script>
<form class="regist_2" action="registra.php" method="post" name="reg_1" enctype="multipart/form-data">
<p><label for="1">用户名:</label><input type="text" class="regist_1" name="user_name" id="1"/></p>
<p><label for="2">登录密码:</label><input type="password" class="regist_1" name="user_password" id="2"/></p>
<p><label for="3">确认密码:</label><input type="password" class="regist_1" name="confermare_psw" id="3"/></p>
<p><label for="4"> 验证码:</label><input type="text" class="regist_1" name="Verfy" id="4"/></p>
<p><label for="5"> 我已阅读并同意<a href="guize.php" target="_blank">《用户使用规则》</a></label><input type="checkbox" name="comferma_rule" id="5"/></p>
<input type="image" src="../icon/btn3.gif" onclick="document.formName.submit()"/>
</form>
<span id="1tip" class="err"></span>
<img src="Verify.php" class="verify">
</body>
<style type="text/css">
#div1{
width:200px;
margin-top:-20px;
margin-left:250px;
}
</style>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(function(){
$("#div1").hide();
//var a=$("#1").val();
var patrn=/^[A-Za-z][A-Za-z0-9_]{2,16}$/;
$("#1").focus(function(){
//alert($("#1").val());
if($("#1").val()==""){
$("#div1").show().css("background-color","#00FFFF").html("请输入用户名!");
return false;
}
});
$("#1").blur(function(){
//alert($("#1").val());
if (!patrn.test($("#1").val())){
$("#div1").show().css("background-color","#FF0000").html("用户名格式不正确");
return false;
}else{
$("#div1").show().css("background-color","#00FF00").html("输入正确");
}
});
})