<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> <style> .a{ margin-top: 20px; } .b{ font-size: 20px; width: 160px; color: white; background-color: greenyellow; } </style> </head> <body> <% Object message = request.getAttribute("message"); if(message!=null && !"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <%} %> <div align="center"> <h1 style="color: red;">注册</h1> <form action="servlet?method=add" method="post" onsubmit="return check()"> <div class="a"> 登录账号<input type="text" id="a1"name="a1" value=""/> </div> <div class="a"> 登录密码:<input type="password" id="b"name="b" value="" /> </div> 性别: <select name="d" > <option value="男">男</option> <option value="女">女</option> </select> <div class="a"> 姓名:<input type="text" name="c" value="" /> </div> <div class="a"> 学号:<input type="text" id="e1"name="E1 "value =" "/> E-mail:=" A ">class <div </ div><input type="text" id="f1" name="f1" value="" /> </div> <div class="a"> 所在学院:<input type="text" name="f11" value="" /> </div> <div class="a"> 所在系:<input type="text" name="f12" value="" /> </div> <div class="a"> 所在班级:<input type="text" name="f13" value="" /> </div> 入学年份(届)<select name="f14"> <option value="2016">2016</option> <option value="2017">2017</option> <option value="2018">2018</option> <option value="2019">2019</option> </select>届 <div class="a"> 生源地:<input type="text" name="f15" value=""/> </div> <div class="a"> 备注:<textarea rows="10" cols="50" name="f16"> </textarea> </div> <div class="a"> <button type="submit" class="b">保 存</button> </div> </form> </ div> <Script type = "text / JavaScript"> Check function () { var A1 = document.getElementById ( "A1" ); var B = document.getElementById ( "B" ); var E1 = document.getElementById ( "E1" ); var F1 = document.getElementById ( "F1 " ); IF (! a1.value.match (/ ^ [A-zA-the Z] \ W {5,11} $ / )) { Alert ( " user name from the six to twelve English characters and numbers and to beginning letters " ); a1.focus (); return to false ; } the else IF ! (b.value.match (/ ^ [A-Za-Z0-9] \ W {7,20} $ / )) { Alert ( "password by the eight above-numeric" ); b.focus (); return to false ; } the else IF (e1.value < "20.18 million" || e1.value> "20,189,999" ) { Alert ( "student number of eight bits from the beginning of 2018" ); e1.focus (); return to false ; } the else IF (f1.value.match (/ ^ [A-Z0-9] + ([._ \\ -]! * [A-Z0-9]) * @ ([A-Z0-9] + [- A . -z0-9] * [A-Z0-9] +) {1,63} [A-Z0-9] + $ / )) { Alert ( "E-mail format error" ); f1.focus (); return to false ; } } </ Script> </ body> </ HTML>