<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<script type="text/javascript">
function checkNull(form1){
/*判断是否有空内容*/
for(i-0;i<form.length;i++){
if(form.elements[i]="null"){
alert("很抱歉,"+form.elements[i].title+"不能为空!");
form.elements[i].focus();
return false;
}
}
/*判断两次密码是否一致*/
var pwd1=document.getElementById("pwd1_id").value;
var pwd2=document.getElementById("pwd2_id").value;
if(pwd1!=pwd2){
alert("两次密码不一致,请确认!");
return false;
}
/*判断电话号码是否有效*/
var phone=document.getElementById("phone_id").value;
var regExpression=/^(86)?((13\d{9})|(15[0,1,2,3,4,5,6,7,8,9]\d{8})|(18[0,5,6,7,8,9]\d{8}))$/;
var obExp=new RegExp(regexpression);
if(obExp.test(phone)==false){
alert("您输入的号码有误!");
return false;
}
/*判断电子邮箱是否有效*/
var email=document.getElementById("email_id").value;
var regExpression=/\w+([-+.]\w+)*@\w([-.]\w+)*\.\w+([-.]\w+)*/;
if(obExp.test(email)==false){
alert("您输入的邮箱地址不正确!");
return false;
}
}
</script>
</head>
<body>
<form action="form1" method="post" action="" onSubmit="return checkNull(form1)">
<table width="296" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#333333" >
<tr>
<td colspan="2" bgcolor="#eeeeee">.用户注册</td>
</tr>
<tr>
<td width="200"align="center" bgcolor="#FFFFFF">用户名:</td>
<td width="384"bgcolor="#FFFFFF"><input name="user" type="text" id="user_id" title="用户名">*</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF">密码:</td>
<td bgcolor="#FFFFFF"><input name="pwd" type="password" id="pwd1_id" title="密码">*</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF">确认密码:</td>
<td bgcolor="#FFFFFF"><input name="pwd2" type="password" id="pwd2_id" title="确认密码">*</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF">电话:</td>
<td bgcolor="#FFFFFF"><input name="phone" type="text" id="phone_id" title="电话">*</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF">邮箱:</td>
<td bgcolor="#FFFFFF"><input name="email" type="text" id="email_id" title="邮箱">*</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"> </td>
<td bgcolor="#FFFFFF"><input name="Submit" type="submit" class="btn_grey" value="提交">
<input name="Submit2" type="reset" class="btn_grey" value="重置">
</td>
</tr>
</table>
</form>
</body>
</html>
相关分类