?? reg.jsp
字號:
<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>用戶注冊</title>
<script type="text/javascript">
function check()
{
var name=form1.username.value;
var pass1=form1.pass1.value;
var pass2=form1.pass2.value;
var sex=form1.sex.value;
var email=form1.email.value;
if(name==""||pass1==""||pass2==""||email=="")
{
alert("請填寫完整信息");
location.reload();
}
else if(pass1!=pass2)
{
alert("兩次密碼輸入不一致");
location.reload();
}
}
function check2()
{
var name=form1.username.value;
if(name=="")
{
alert("請輸入姓名!");
location.reload();
}
else
{
window.location.href="checkName?UserName="+name;
}
}
</script>
</head>
<body>
<%
Object obj1=session.getAttribute("thisName");
String thisName="";
if(obj1!=null){
thisName=obj1.toString();
}
Object obj=session.getAttribute("empty");
if(obj!=null){
String s=obj.toString();
if(s.equals("0")){
out.print("<script>");
out.print("alert('恭喜您!用戶名可用')");
out.print("</script>");
session.removeAttribute("empty");
}else {
out.print("<script>");
out.print("alert('用戶名已被占用!')");
out.print("</script>");
session.removeAttribute("empty");
}
}
%>
<center>
<form action="regServ" name="form1">
<table cellpadding="3">
<tr align=left>
<td>用戶名:</td>
<td><input name="username" value=<%=thisName %>>
<input type="button" value="檢查用戶名是否可用" onclick="check2()">
</td>
</tr>
<tr align=left>
<td>密碼:</td>
<td><input name="pass1"></td>
</tr>
<tr align=left>
<td>確認密碼:</td>
<td><input name="pass2"></td>
</tr>
<tr align=left>
<td>性別:</td>
<td>
<input type="radio" name="sex" value="男" checked>男
<input type="radio" name="sex" value="女">女
</td>
</tr>
<tr align=left>
<td>電子郵件:</td>
<td><input name="email"></td>
</tr>
<tr>
<td colspan="2"><br><input type="submit" value="注冊" onclick="check()">
<input type="reset" value="重置"></td>
</tr>
</table>
</form>
</center>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -