復制代碼 代碼如下:
<%@ page contentType="text/html; charset=utf-8"%>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用戶注冊</title>
<script language="javascript">
<!--
function MyForm(){
msg.innerHTML="debug::in function";
var username = document.form1.username.value;
var msg = document.getElementById("msg");
if(username.length==0){
msg.innerHTML="[ 提示:用戶名不能為空! ]";
document.form1.username.focus();
return false;
}
var pass = document.form1.password.value;
if(pass.length==0){
msg.innerHTML="[ 提示:密碼不能為空! ]";
document.form1.password.focus();
return false;
}
var pass1 = document.form1.password1.value;
if(pass1.length==0){
msg.innerHTML="[ 提示:確認密碼不能為空! ]";
document.form1.password1.focus();
return false;
}
if(pass1!=pass){
msg.innerHTML="[ 提示:您兩次輸入的密碼不一致! ]";
document.form1.passwoid.focus();
return false;
}
var mail = document.form1.mail.value;
if(mail.length==0){
msg.innerHTML="[ 提示:E_mail不能為空! ]";
document.form1.mail.focus();
return false;
}
var i = form1.mail.value.indexOf("@");
var j = form1.mail.value.indexOf(".");
if((i<0)||(j<0)||(i-j>0))
{
msg.innerHTML="[ 提示:您輸入的E_mail格式不正確,請正確輸入! ]";
document.form1.mail.focus();
return false;
}
msg.innerHTML="";
return true;
}
-->
</script>
</head>
<body onload="document.form1.username.focus()">
<form id="form1" name="form1" method="post" action="" onsubmit="return MyForm()">
<table width="389" border="1" align="center" cellpadding="5">
<tr>
<td colspan="2"><div align="center">用戶注冊<br /></div></td>
</tr>
<tr>
<td colspan="2" align="center" bordercolor=""
bgcolor="">
<font color="red"><span id="msg">${error}</span> </font>
</td>
</tr>
<tr>
<td width="71">用戶名:</td>
<td width="286"><label>
<input name="username" type="text" id="username" size="20" />
</label>
*(必填)</td>
</tr>
<tr>
<td>用戶密碼:</td>
<td><label>
<input name="password" type="password" id="password" size="20" />
</label>
*(必填)</td>
</tr>
<tr>
<td>重復密碼:</td>
<td><label>
<input name="password1" type="password" id="password1" size="20" />
</label>
*(必填)</td>
</tr>
<tr>
<td>電子郵件:</td>
<td><label>
<input name="mail" type="text" id="mail" size="25" />
</label>
*(必填)</td>
</tr>
<tr>
<td>電話:</td>
<td><label>
<input name="tel" type="text" id="tel" size="22" />
</label></td>
</tr>
<tr>
<td>QQ:</td>
<td><label>
<input name="qq" type="text" id="qq" size="22" />
</label></td>
</tr>
<tr>
<td colspan="2"><label>
<div align="center">
<input type="submit" name="Submit" value="注冊" />
<input type="reset" name="Submit2" value="重置" />
</div>
</label></td>
</tr>
</table>
</form>
</body>
</html>