📄 register.jsp.htm
字号:
<html>
<head>
<title>用户注册</title>
<script language="JavaScript">
function checkdata()
{
username=document.myform.username.value;
password1=document.myform.password1.value;
password2=document.myform.password2.value;
age=document.myform.age.value;
email=document.myform.email.value;
phone=document.myform.phone.value;
address=document.myform.address.value;
if(username.length<1||username.length>20)
{
alert("用户名长度必须在1位到20位之间");
return false;
}
if(password1.length<6||password1.length>10)
{
alert("密码长度必须在6位到10位之间");
return false;
}
if(password1!=password2)
{
alert("密码不匹配");
return false;
}
if(email==""||(email.indexOf('@')==-1)||(email.indexOf('.')==-1))
{
alert("电子邮件填写不正确");
return false;
}
if(age==""||isNaN(age)||parseInt(age)<0||parseInt(age)>99)
{
alert("年龄不合要求");
return false;
}
if(phone==""||isNaN(phone)||parseInt(phone)<0)
{
alert("电话号码不合规范");
return false;
}
if(address=="")
{
alert("地址不能为空");
return false;
}
return true;
document.myform.submit();
}
</script>
</head>
<%@ page contentType="text/html;charset=GB2312" %>
<body>
<center><h2>
用户注册
</h2></center>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>请输入您的个人信息:</td>
</tr>
<tr>
<td>
<br><br>
<form name="myform" method="post" action="chkregister.jsp" OnSubmit="return checkdata();">
<table width="70%" border="1" align="center">
<tr>
<td width="37%">用户名: </td>
<td width="63%">
<input type="text" name="username">
<input type="button" value="检查用户名" onclick="window.open('chname.jsp?username='+this.form.username.value);">
</td>
</tr>
<tr>
<td width="37%">密码:</td>
<td width="63%">
<input type="password" name="password1">
</td>
</tr>
<tr>
<td width="37%">密码确认:</td>
<td width="63%">
<input type="password" name="password2">
</td>
</tr>
<tr>
<td width="37%">电子邮件: </td>
<td width="63%">
<input type="text" name="email">
</td>
</tr>
<tr>
<td width="37%">性别: </td>
<td width="63%">
<input type="radio" name="sex" value="men" checked>
<img src="images/boy.gif" width="24" height="24">男孩
<input type="radio" name="sex" value="women">
<img src="images/girl.gif" width="26" height="26">女孩
</td>
</tr>
<tr>
<td width="37%">年龄: </td>
<td width="63%">
<input type="text" name="age">
</td>
</tr>
<tr>
<td width="37%">头像: </td>
<td width="63%">
<select name="face" size=1 onChange="document.images['face'].src=options[selectedIndex].value;">
<%
for (int i=1;i<=60;i++)
out.println("<option value=images/face/Image" + i + ".gif>Image"+ i +"</option>");
%>
</select>
<img id=face src="images/face/Image1.gif">
</td>
</tr>
<tr>
<td width="37%">电话: </td>
<td width="63%">
<input type="text" name="phone">
</td>
</tr>
<tr>
<td width="37%">地址: </td>
<td width="63%">
<input type="text" name="address">
</td>
</tr>
<tr>
<td colspan=2>
<center>
<input type="submit" value="注册">      
<input type="reset" value="重置">
</center>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -