|
一个简单的jsp注册页面
|
|
来源:百家拳软件教程网 作者:葫芦娃 |
|
前几天,有人问我jsp注册页面如何写,我在这里给大家写一个jsp注册页面,希望大家共同研究。 代码如下: <%@ taglib prefix="year" uri="WEB-INF/year.tld"%> <!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>BBS注册页面</title> <link href="css/style1.css" rel="stylesheet" type="text/css" /> <link href="css/style2.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- .STYLE1 {color: #FF0000} --> </style> <script language="javascript"> //检查提交表单中的数据 function checkFunction(){ var nickname=document.form1.nickname.value; //昵称 if(nickname.length<=0){ alert("用户名不能为空"); return false; } if(nickname.length<3||nickname.length>20){ alert("用户名要求在3-20个字符之间"); return false; } if(nickname.indexOf(" ")!=-1){ alert("用户名不能出现空格"); return false; } var password=document.form1.password.value; //密码 if(password.length<=0){ alert("密码不能为空"); return false; } if(password.length<6&&password.length>0){ alert("密码长度不能小于6位"); return false; } if(password.indexOf(" ")!=-1){ alert("密码不能有空格"); return false; } var password1=document.form1.password1.value; //密码 if(password1.length<=0){ alert("确认密码不能为空"); return false; } if(password1.length<6&&password1.length>0){ alert("确认密码长度不能小于6位"); return false; } if(password1.indexOf(" ")!=-1){ alert("确认密码不能有空格"); return false; } if(password1!=password){ alert("两次输入密码不一致"); return false; } var number=document.form1.number.value; if(number.length<=0){ alert("验证码不能为空"); return false; } if(number.length!=4){ alert("验证码只能是四位"); return false; } if(number.indexOf(" ")!=-1){ alert("验证码不能有空格"); return false; } /**************校验Email********************/ var email=document.form1.email.value; if(email.length<=0){ alert("Email不能为空"); return false; } if(email.indexOf(" ")!=-1){ alert("Email不能有空格"); return false; } var t1=email.charAt(0)=="."; var t2=email.charAt(0)=="@"; var t3=email.charAt(email.length-1)=="."; var t4=email.charAt(email.length-1)=="@"; var t5=email.indexOf(".")==email.lastIndexOf("."); var t6=email.indexOf("@")==email.lastIndexOf("@"); var t7=email.indexOf(".")==-1; var t8=email.indexOf("@")==-1; if(t1||t2||t3||t4||!t5||!t6||t7||t8){ alert("Email格式不正确"); return false; } var reason=document.form1.reason.value; if(reason.length<=0){ alert("注册原因不能为空"); return false; } /*******************校验OICQ***********************/ var oicq=document.form1.oicq.value; if(oicq.length>0){ var v="1234567890"; for(i=0;i<oicq.length;i++){ if(v.indexOf(oicq.charAt(i))!=-1){ alert("OICQ必须全部是数字"); break; return false; } } } return true; } function monthMethod(){ var selectIndex=document.form1.month.options.selectedIndex; var v=document.form1.month.options[selectIndex].value; //选中的月份 var selectYearIndex=document.form1.year.options.selectedIndex; var year=document.form1.year.options[selectYearIndex].value; //选中的年份 if(v==1){ var list=document.form1.day; //日列表选项 while (list.options.length > 0){ list.options[0] = null; }
for(i=1;i<=31;i++){ list.options[i-1]=new Option(i,i); } } if(v==2){ var list=document.form1.day; //日列表选项 while (list.options.length > 0){ list.options[0] = null; } if((year%4==0&&year%100!=0)||year%400==0){ for(i=1;i<=29;i++){ list.options[i-1]=new Option(i,i); } } else{ for(i=1;i<=28;i++){ list.options[i-1]=new Option(i,i); } } } if(v==3){ var list=document.form1.day; //日列表选项 while (list.options.length > 0){ list.options[0] = null; } for(i=1;i<=31;i++){ list.options[i-1]=new Option(i,i); } } if(v==4){ var list=document.form1.day; //日列表选项 while (list.options.length > 0){ list.options[0] = null; } for(i=1;i<=30;i++){ list.options[i-1]=new Option(i,i); } } if(v==5){ var list=document.form1.day; //日列表选项 while (list.options.length > 0){ list.options[0] = null; } for(i=1;i<=31;i++){ list.options[i-1]=new Option(i,i); } } if(v==6){ var list=document.form1.day; //日列表选项 while (list.options.length > 0){ list.options[0] = null; } for(i=1;i<=30;i++){ list.options[i-1]=new Option(i,i); } } if(v==7){ var list=document.form1.day; //日列表选项 while (list.options.length > 0){ list.options[0] = null; } for(i=1;i<=31;i++){ list.options[i-1]=new Option(i,i); } }
if(v==8){ var list=document.form1.day; //日列表选项 while (list.options.length > 0){ list.options[0] = null; } for(i=1;i<=31;i++){ list.options[i-1]=new Option(i,i); } } if(v==9){ var list=document.form1.day; //日列表选项 while (list.options.length > 0){ list.options[0] = null; } for(i=1;i<=30;i++){ list.options[i-1]=new Option(i,i); } } if(v==10){ var list=document.form1.day; //日列表选项 while (list.options.length > 0){ list.options[0] = null; } for(i=1;i<=31;i++){ list.options[i-1]=new Option(i,i); } } if(v==11){ var list=document.form1.day; //日列表选项 while (list.options.length > 0){ list.options[0] = null; } for(i=1;i<=30;i++){ list.options[i-1]=new Option(i,i); } } if(v==12){ var list=document.form1.day; //日列表选项 while (list.options.length > 0){ list.options[0] = null; } for(i=1;i<=31;i++){ list.options[i-1]=new Option(i,i); } } } function checkYear(){ var selectYearIndex=document.form1.year.options.selectedIndex; var year=document.form1.year.options[selectYearIndex].value; //选中年份 var selectIndex=document.form1.month.options.selectedIndex; var v=document.form1.month.options[selectIndex].value; //选中月份 if(v==2){ var list=document.form1.day; //日列表选项 while (list.options.length > 0){ list.options[0] = null; } if((year%4==0&&year%100!=0)||year%400==0){ for(i=1;i<=29;i++){ list.options[i-1]=new Option(i,i); } } else{ for(i=1;i<=28;i++){ list.options[i-1]=new Option(i,i); } } } } </script> </head>
<body> <div id="header"> <div class="tr2 toptool tar"> <a href="" target="_blank">无图版</a> <a href="">左右分栏</a> </div> <table align="center" cellpadding="0" cellspacing="0" width="100%"> <tbody><tr> <td class="banner"><h1><img src="pic/logo-0201.jpg" width="179px" height="90px" style="margin: 0pt 0.5% 5px;"><span class="quote STYLE3">欢迎访问凤凰BBS</span></h1></td> <td class="banner" align="right"></td> </tr> </tbody></table> <div class="h guide" colspan="2">»
您尚未 <a href="http://bbs.52happy.net/login.php">登录</a> <a href="http://bbs.52happy.net/register.php"><b>注册</b></a>
| <a href="http://bbs.52happy.net/search.php">搜索</a> | <a style="cursor: pointer;" id="td_hack" onclick="click_open('menu_hack','td_hack');" onmouseover="mouseover_open('menu_hack','td_hack');">社区服务</a>
| <a href="http://bbs.52happy.net/faq.php">帮助</a>
</div> <p><img src="pic/home.gif" width="14px" height="14px" align="absbottom" /> <b><a href="http://bbs.52happy.net/index.php">凤凰BBS </a> -> 注册程式</b></p> <div class="t"> <form id="form1" name="form1" method="post" action="register.do"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="2" class="h">必填信息</td> </tr> <tr class="tr3 f_one"> <td width="35%">用户名<span class="STYLE1">*</span><br /> 不能有空格,可以是中文,长度控制在 3 - 20 字节以内</td> <td width="65%"><label> <input name="nickname" type="text" class="input" id="nickname" size="25" maxlength="20" /> <input name="bt" type="button" class="btn" id="bt" value="检查用户名" /> </label></td> </tr> <tr class="tr3 f_two"> <td>密码<span class="STYLE1">*</span><br /> 英文字母或数字等不少于6位</td> <td><label> <input name="password" type="password" class="input" id="password" size="25" maxlength="20" /> </label></td> </tr> <tr class="tr3 f_one"> <td>确认密码<span class="STYLE1">*</span></td> <td><label> <input name="password1" type="password" class="input" id="password1" size="25" maxlength="20" /> </label></td> </tr> <tr class="tr3 f_one"> <td>认证码<span class="STYLE1">*</span></td> <td><label> <input name="number" type="text" class="input" id="number" size="10" maxlength="4" /> <img src="/BBS/servlet/ImageServlet"/> </label></td> </tr> <tr class="tr3 f_two"> <td>Email<span class="STYLE1">*</span><br /> 为避免无法收取论坛邮件,请使用以下邮箱进行注册:<br/> (126.com,21cn.com,163.com,hotmail.com) </td> <td><label> <input name="email" type="text" class="input" id="email" size="40" maxlength="80" /> </label></td> </tr> <tr class="tr3 f_one"> <td>注册原因<span class="STYLE1">*</span></td> <td><label> <textarea name="reason" cols="50" rows="5" class="input" id="reason"></textarea> </label></td> </tr> <tr> <td colspan="2" class="h">选添信息</td> </tr> <tr class="tr3 f_one"> <td>性别</td> <td><label> <select name="sex" id="sex"> <option value="保密">保密</option> <option value="男">男</option> <option value="女">女</option> </select> </label></td> </tr> <tr class="tr3 f_one"> <td>生日</td> <td><label> <select name="year" id="year" onchange="checkYear()"> <year:loop/> </select> 年 <select name="month" id="month" onchange="monthMethod()"> <option value="1" selected="selected">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> 月 <select name="day" id="day" selected="selected"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> </select> 日</label></td> </tr> <tr class="tr3 f_two"> <td>OICQ</td> <td><label> <input name="oicq" type="text" class="input" id="oicq" size="20" maxlength="15" /> </label></td> </tr> <tr class="tr3 f_two"> <td>个人主页</td> <td><label> <input name="website" type="text" class="input" id="website" size="80" maxlength="60" /> </label></td> </tr> <tr class="tr3 f_one"> <td>自我简介<br /> --少于200字</td> <td><label> <textarea name="text" cols="50" rows="4" class="input" id="text"></textarea> </label></td> </tr> <tr class="tr3 f_one"> <td>是否接受系统邮件</td> <td><label> <input name="accept" type="radio" value="true" checked="checked" /> 接收邮件 <input type="radio" name="accept" value="false" /> 不接收邮件</label></td> </tr> </table> <p align="center"> <input type="submit" value="提交" class="btn" onclick="javascript:checkFunction()"/> <input type="reset" value="重设" class="btn"/> </p> </form> </div> </body> </html>
|
| 上一篇:哲学家就餐问题 --C原代码 下一篇:垃圾邮件伪装马尾辫女生 美女图片暗藏木马 |
|
[ 收藏]
[ 推荐]
[ 评论(0条)]
[返回顶部] [打印本页]
[关闭窗口] |
|
|
| |
|
|
 |
|
相关信息 |
|
|
|
|
|