index.jsp
上傳用戶:hailan_hsm
上傳日期:2020-02-17
資源大小:44115k
文件大小:7k
源碼類別:

JavaScript

開發平臺:

JavaScript

  1. <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
  2. <html>
  3. <head>
  4. <title></title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  6. <link href="CSS/style.css" rel="stylesheet">
  7. <script language="javascript">
  8. var http_request = false;
  9. function createRequest(url) {
  10. //初始化對象并發出XMLHttpRequest請求
  11. http_request = false;
  12. if (window.XMLHttpRequest) { // Mozilla或其他除IE以外的瀏覽器
  13. http_request = new XMLHttpRequest();
  14. if (http_request.overrideMimeType) {
  15. http_request.overrideMimeType("text/xml");
  16. }
  17. } else if (window.ActiveXObject) { // IE瀏覽器
  18. try {
  19. http_request = new ActiveXObject("Msxml2.XMLHTTP");
  20. } catch (e) {
  21. try {
  22. http_request = new ActiveXObject("Microsoft.XMLHTTP");
  23.    } catch (e) {}
  24. }
  25. }
  26. if (!http_request) {
  27. alert("不能創建XMLHTTP實例!");
  28. return false;
  29. }
  30. http_request.onreadystatechange = alertContents;    //指定響應方法
  31. //發出HTTP請求
  32. http_request.open("GET", url, true);
  33. http_request.send(null);
  34. }
  35. function alertContents() {    //處理服務器返回的信息
  36. if (http_request.readyState == 4) {
  37. if (http_request.status == 200) {
  38. alert(http_request.responseText);
  39. } else {
  40. alert('您請求的頁面發現錯誤');
  41. }
  42. }
  43. }
  44. </script>
  45. <script language="javascript">
  46. function checkName() {
  47. var username = form1.username.value;
  48. if(username=="") {
  49. window.alert("請添寫用戶名!");
  50. form1.username.focus();
  51. return false;
  52. }
  53. else {
  54. createRequest('checkName.jsp?username='+username);
  55. }
  56. }
  57. </script>
  58. </head>
  59. <body>
  60. <table width="599"  border="0" align="center" cellpadding="0" cellspacing="0">
  61.   <tr>
  62.     <td width="36" valign="top" bgcolor="#FFFFFF">&nbsp;</td>
  63.     <td width="552" valign="top" bgcolor="#FFFFFF"><table width="100%"  border="0" cellpadding="0" cellspacing="0">
  64.         <tr>
  65.           <td width="10" valign="top">&nbsp;</td>
  66.           <td width="542" valign="top"><table width="100%" height="350"  border="0" cellpadding="0" cellspacing="0">
  67.             <tr>
  68.               <td width="25" height="350" valign="top">&nbsp;</td>
  69.               <td width="567" valign="top">
  70.                 <table width="100%"  border="0" cellspacing="0" cellpadding="0">
  71.                   <tr>
  72.                     <td width="100%" height="5"></td>
  73.                   </tr>
  74.                   <tr valign="top">
  75.                     <td height="41" background="Images/center_how.GIF"><table width="100%" height="29"  border="0" cellpadding="0" cellspacing="0">
  76.                       <tr>
  77.                         <td width="6%" height="7">&nbsp;</td>
  78.                         <td width="94%">&nbsp;</td>
  79.                       </tr>
  80.                       <tr>
  81.                         <td>&nbsp;</td>
  82.                         <td>注冊新用戶</td>
  83.                       </tr>
  84.                     </table></td>
  85.                   </tr>
  86.                   <tr align="center" valign="top">
  87.                     <td height="69">
  88.    <form name="form1" method="post" action="">
  89.      <table width="76%" height="295"  border="0" cellpadding="0" cellspacing="0">
  90.                        <tr>
  91.                          <td width="22%">&nbsp;</td>
  92.                          <td width="78%">&nbsp;</td>
  93.                        </tr>
  94.                        <tr>
  95.                          <td align="center">用戶名:</td>
  96.                          <td><input name="username" type="text" class="table" id="username">
  97.                              <a href="#" onClick="checkName()">[檢測用戶]</a>&nbsp;*</td>
  98.                        </tr>
  99.                        <tr>
  100.                          <td align="center">密碼:</td>
  101.                          <td class="word"><input name="PWD1" type="password" class="table" id="PWD1">
  102.                            *</td>
  103.                        </tr>
  104.                        <tr>
  105.                          <td align="center">確認密碼:</td>
  106.                          <td class="word"><input name="PWD2" type="password" class="table" id="PWD2">
  107.                            *</td>
  108.                        </tr>
  109.                        <tr>
  110.                          <td align="center">生日:</td>
  111.                          <td class="word"><input name="birthday" type="text" class="table" id="birthday">
  112.                            (格式:1980-07-17)</td>
  113.                        </tr>
  114.                        <tr>
  115.                          <td align="center">性別:</td>
  116.                          <td><input name="sex" type="radio" value="男" checked>
  117.                            男生 
  118.                            <input type="radio" name="sex" value="女">
  119.                            女生</td>
  120.                        </tr>
  121.                        <tr>
  122.                          <td align="center">OICQ號碼:</td>
  123.                          <td><input name="OICQ" type="text" class="table" id="OICQ"></td>
  124.                        </tr>
  125.                        <tr>
  126.                          <td align="center">電話:</td>
  127.                          <td><input name="tel" type="text" class="table" id="tel"></td>
  128.                        </tr>
  129.                        <tr>
  130.                          <td align="center">個人主頁:</td>
  131.                          <td><input name="homepage" type="text" class="table" id="homepage" size="50"></td>
  132.                        </tr>
  133.                        <tr>
  134.                          <td align="center">地址:</td>
  135.                          <td><input name="address" type="text" class="table" id="address" size="50"></td>
  136.                        </tr>
  137.                        <tr>
  138.                          <td align="center">郵政編碼:</td>
  139.                          <td><input name="postcode" type="text" class="table" id="postcode"></td>
  140.                        </tr>
  141.                        <tr>
  142.                          <td align="center">Email:</td>
  143.                          <td class="word"><input name="Email" type="text" class="table" id="Email" size="50">
  144.                            *</td>
  145.                        </tr>
  146.                        <script language="javaScript">
  147.   function mycheck(){
  148.    if(form1.username.value==""){
  149. alert("請輸入用戶名!");form1.username.focus();return; }
  150. if(form1.PWD1.value==""){
  151. alert("請輸入密碼!");form1.PWD1.focus();return;}
  152.    if(form1.PWD2.value==""){
  153. alert("請確認密碼!");form1.PWD2.focus();return;}
  154.    if(form1.PWD1.value!=form1.PWD2.value){
  155. alert("您兩次輸入的密碼不一致,請重新輸入!");
  156. form1.PWD1.value="";form1.PWD2.value="";form1.PWD1.focus();return;}
  157. if(form1.Email.value==""){
  158. alert("請輸入Email地址!");form1.Email.focus();return; }
  159. form1.submit();
  160.   }
  161.              </script>
  162.                        <tr>
  163.                          <td colspan="2" align="center"><input name="save" type="button" class="btn_grey" onClick="mycheck()" value="保存">
  164.                               &nbsp;
  165.                               <input name="re" type="reset" class="btn_grey" value="重置"></td>
  166.                        </tr>
  167.                      </table>
  168.    </form></td>
  169.                   </tr>
  170.                 </table>
  171.                 </td>
  172.             </tr>
  173.           </table></td>
  174.         </tr>
  175.     </table></td>
  176.     <td width="11" valign="top" bgcolor="#FFFFFF">&nbsp;</td>
  177.   </tr>
  178. </table>
  179. </body>
  180. </html>
黑龙江省22选5