?? 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 + -