<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
<style type="text/css">
.td_left{
width:150px;
text-align:right;
}
</style>
<script type="text/javascript">
function saveform(form){
var email=form.form_email.value;
var password=form.form_password.value;
var confirmpassword=form.form_checkpassword.value;
if(email !="" && !checkemail(email)){
alert("邮箱格式错误,请重新填写");
return false;
}else if(email==""){
alert("邮箱不能为空");
return false;
}
}
var checkpasswordinfo=checkpassword(password,confirmpassword);
if(checkpasswordinfo != "success"){
info.innerHTML=checkpasswordinfo;
return false;
}
function checkemail(email){
var regu="^([\.A-Za-z0-9_-])+@([A-Za-z0-9_-])+(\.[A-Za-z0-9_-])+";
var re=new RegExp(regu);
return re.test(email);
}
function checkpassword(password,confirmpassword){
var info="success";
if(password=="" || confirmpassword==""){
alert("密码/确认密码不能为空");
} else{
if(password != confirmpassword){
alert("密码/确认密码请保持一致");
}
}
}
</script>
</head>
<body>
<div>
<form method="post">
<table>
<tr>
<td>邮箱:</td>
<td><input type="email" name="form_email"/></td>
</tr>
<tr>
<td>密码:</td>
<td><input type="password" name="form_password"/></td>
</tr>
<tr>
<td>确认密码:</td>
<td><input type="password" name="form_checkpassword"/></td>
</tr>
<tr>
<td></td>
<td><input type="button" onclick="saveform(this)" value="登录"/></td>
</tr>
</table>
</form>
</div>
</body>
</html>
李晓健
相关分类