baoming.jsp 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <%@ page language="java" contentType="text/html; charset=UTF-8"
  2. pageEncoding="UTF-8"%>
  3. <!DOCTYPE html>
  4. <html>
  5. <head>
  6. <meta charset="UTF-8">
  7. <title>校运会报名</title>
  8. <style type="text/css">
  9. *{ margin: 0;
  10. padding: 0;
  11. }
  12. html {
  13. background: linear-gradient(to top right, white 0%, skyblue 98%, blue 100%);
  14. font-family: "宋体";
  15. background-repeat: no-repeat;
  16. width: 100%;
  17. height: 100%;
  18. }
  19. h1{
  20. color: white;
  21. margin-left: 20px;
  22. margin-top: 15px;
  23. }
  24. h4{ color: white;
  25. margin-left: 20px;
  26. }
  27. .a{
  28. height: 20px;
  29. width: 95%;
  30. background: linear-gradient(to bottom, white 25%, gray 100%);
  31. margin-top: 10px;
  32. margin-left: 20px;
  33. }
  34. form{height:525px;
  35. width: 550px;
  36. margin: 30px 0 0 400px;
  37. }
  38. table{margin:10px 0 0 70px;
  39. line-height: 50px;
  40. }
  41. </style>
  42. <script type="text/javascript" src="js/jquery-3.4.1.min.js" charset="utf-8"></script>
  43. <script type="text/javascript">
  44. function check(){
  45.  var name = document.getElementById("name").value;
  46. var num = document.getElementById("num").value;
  47. var class0 = document.getElementById("class0").value;
  48. var telephone = document.getElementById("telephone").value;
  49.  if(name == null || name == ""){
  50.   alert("姓名不能为空");
  51.   return false;
  52.  }else if(num == null || num == ""){
  53. alert("学号/工号不能为空")
  54.  }else if(class0 == null || class0 == ""){
  55. alert("班级/单位不能为空")
  56.  }else if(telephone == null || telephone == ""){
  57. alert("联系电话不能为空")
  58.  }
  59.   return true;
  60.  }
  61. $(function(){
  62. $("#btnSubmit").click(function(){
  63. var val=$('input:radio[name="sex"]:checked').val();
  64. if(val==null){
  65. alert("请选择性别");
  66. return false;
  67. }
  68. else{
  69. return true;
  70. }
  71. });
  72. });
  73. </script>
  74. </head>
  75. <body>
  76. <h1>
  77. 深圳信息职业技术学院校运会报名
  78. </h1>
  79. <h4>Shenzhen Vocational and Technical College of Information Enrollment for School Games</h4>
  80. <div class="a"></div>
  81. <div class="d">
  82. <form action="enter.do" method="post" onsubmit="return check();">
  83. <fieldset style="width: 550px;margin: 0 auto">
  84. <legend>报名信息</legend>
  85. <table border="0" cellspacing="0" cellpadding="10">
  86. <tr>
  87. <td>
  88. 姓名:<input type="text" name="name" id="name" onkeyup="this.value=this.value.replace(/[^\u4e00-\u9fa5]/g,'')">
  89. </td>
  90. </tr>
  91. <tr>
  92. <td>
  93. 学号/工号:<input type="text" name="num" id="num" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
  94. </td>
  95. </tr>
  96. <tr>
  97. <td>
  98. 学院/单位:<input type="text" name="class0" id="class0">
  99. </td>
  100. </tr>
  101. <tr>
  102. <td>
  103. 性别:
  104. <input type="radio" name="sex" id="sex" value="男">男
  105. <input type="radio" name="sex" id="sex" value="女">女
  106. </td>
  107. </tr>
  108. <tr>
  109. <td>
  110. 联系电话:<input type="text" name="telephone" id="telephone" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
  111. </td>
  112. </tr>
  113. <tr>
  114. <td>
  115. 请选择报名组别:<select name="group" id="province" runat="server" onchange="selectprovince(this);" style=" width:95px;"></select>
  116. </td>
  117. </tr>
  118. <tr>
  119. <td>
  120. 请选择报名项目:<select name="project" id="city" runat="server" style=" width:95px;"></select>
  121. </td>
  122. </tr>
  123. <tr>
  124. <td>
  125. <input type="submit" value="提交报名信息" id="btnSubmit">
  126. <input type="reset" name="reset" value="重置">
  127. </td>
  128. </tr>
  129. </table>
  130. </fieldset>
  131. </form>
  132. <script type="text/javascript">
  133. var list1 = new Array;
  134. var list2 = new Array;
  135. list1[list1.length] = "学生组";
  136. list1[list1.length] = "教工青年组";
  137. list1[list1.length] = "教工中年组";
  138. list1[list1.length] = "教工老年组";
  139. list2[list2.length] = new Array("100米", "200米", "400米", "800米", "1500米", "3000米", "4×100米接力", "跳高","三级跳远", "铅球");
  140. list2[list2.length] = new Array("100米", "800米", "跳高","跳远","铅球");
  141. list2[list2.length] = new Array("60米", "800米", "跳高","跳远","铅球");
  142. list2[list2.length] = new Array("60米", "50米托球跑","跳远","铅球");
  143. var ddlProvince = document.getElementById("province");
  144. var ddlCity = document.getElementById("city");
  145. for(var i =0;i<list1.length; i++)
  146. {
  147. var option = document.createElement("option");
  148. option.appendChild(document.createTextNode(list1[i]));
  149. option.value = list1[i];
  150. ddlProvince.appendChild(option);
  151. //city initialize
  152. var firstprovince = list2[0];
  153. for (var j = 0; j < firstprovince.length; j++) {
  154. var optioncity = document.createElement("option");
  155. optioncity.appendChild(document.createTextNode(firstprovince[j]));
  156. optioncity.value = firstprovince[j];
  157. ddlCity.appendChild(optioncity);
  158. }
  159. }
  160. function indexof(obj,value)
  161. {
  162. var k=0;
  163. for(;k<obj.length;k++)
  164. {
  165. if(obj[k] == value)
  166. return k;
  167. }
  168. return k;
  169. }
  170. function selectprovince(obj) {
  171. ddlCity.options.length = 0;//clear
  172. var index = indexof(list1,obj.value);
  173. var list2element = list2[index];
  174. for(var i =0;i<list2element.length; i++)
  175. {
  176. var option = document.createElement("option");
  177. option.appendChild(document.createTextNode(list2element[i]));
  178. option.value = list2element[i];
  179. ddlCity.appendChild(option);
  180. }
  181. }
  182. </script>
  183. </body>
  184. </html>