亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

搜索
博主信息
博文 12
粉絲 0
評論 0
訪問量 6487
最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板
制作一個用戶注冊表單
len
原創(chuàng)
716人瀏覽過

程序?qū)崿F(xiàn)

  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <title>用戶注冊</title>
  8. <style>
  9. .regLabel {
  10. width: 4em;
  11. text-align: justify;
  12. text-align-last: justify;
  13. }
  14. </style>
  15. </head>
  16. <script src="checkPassword.js"></script>
  17. <body>
  18. <form action="register.php" method="post" class="formregister">
  19. <!-- fieldset>legend{用戶注冊}+.register.username>label[for="uname"]{用戶名}+input:text[name="uname"]^.psw>label[for="password"]{密碼}+input:password[name="password"]^.psw>label{確認(rèn)密碼}+input:password^.department>label{部門}+select^.email>label{郵箱}+input:email^.phone>label{手機(jī)}+input:number -->
  20. <fieldset style="display: inline-grid; gap: 1em">
  21. <legend>用戶注冊</legend>
  22. <div class="register username">
  23. <label for="uname">用戶名</label>
  24. <input
  25. type="text"
  26. name="uname"
  27. id="uname"
  28. placeholder="用戶名不少于6位"
  29. required
  30. autofocus
  31. />
  32. </div>
  33. <div class="psw">
  34. <label for="password">密碼</label>
  35. <input
  36. type="password"
  37. name="password"
  38. id="password"
  39. required
  40. placeholder="密碼不能少于8位"
  41. />
  42. </div>
  43. <div class="psw">
  44. <label for="passwordConfirm">確認(rèn)密碼</label>
  45. <input
  46. type="password"
  47. name="password"
  48. id="passwordConfirm"
  49. required
  50. placeholder="請再輸一遍密碼"
  51. onblur="checkPassword(document.getElementById('password').value,this.value)"
  52. />
  53. </div>
  54. <div class="department">
  55. <label for="department">部門</label>
  56. <select name="department" id="department" required>
  57. <option value="" selected disabled>請選擇</option>
  58. <!-- option[value="$"]{財務(wù)}*6 -->
  59. <option value="1">普通用戶</option>
  60. <option value="2">采購</option>
  61. <option value="3">銷售</option>
  62. <option value="4">財務(wù)</option>
  63. <option value="5">管理員</option>
  64. <option value="6">超級管理員</option>
  65. </select>
  66. </div>
  67. <div class="email">
  68. <label for="email">郵箱</label>
  69. <input
  70. type="email"
  71. name="email"
  72. id="email"
  73. required
  74. placeholder="username@email.com"
  75. />
  76. </div>
  77. <div class="phone">
  78. <label for="phone">手機(jī)</label>
  79. <input
  80. type="tel"
  81. pattern="[0-9]{11}"
  82. name="phone"
  83. id="phone"
  84. required
  85. placeholder="請輸入11位手機(jī)號碼"
  86. />
  87. </div>
  88. <!-- .gender>label{性別}+input:radio[name="gender" id="male" value="1" checked]+label{男}+input:radio[name="gender" id="female" value="0"]+label{女} -->
  89. <div class="gender">
  90. <label for="male">性別</label>
  91. <input
  92. type="radio"
  93. name="gender"
  94. id="male"
  95. value="1"
  96. checked="checked"
  97. />
  98. <label for=""></label>
  99. <input type="radio" name="gender" id="female" value="0" />
  100. <label for=""></label>
  101. </div>
  102. <div class="birthday">
  103. <label for="birthday">生日</label>
  104. <input
  105. type="date"
  106. name="birthday"
  107. id="birthday"
  108. value="2000-01-01"
  109. min="1950-01-01"
  110. required
  111. />
  112. </div>
  113. <!-- .field>label{負(fù)責(zé)客戶}+input:checkbox[name="customer" checked]+label{客戶1}+input:checkbox[name="customer"]+label{客戶2}+input:checkbox[name="customer"]+label{客戶3} -->
  114. <div class="field">
  115. <label for="field1">負(fù)責(zé)客戶</label>
  116. <input
  117. type="checkbox"
  118. name="customer[]"
  119. id="field1"
  120. checked="checked"
  121. />
  122. <label for="field1">客戶1</label>
  123. <input type="checkbox" name="customer[]" id="field2" />
  124. <label for="field2">客戶2</label>
  125. <input type="checkbox" name="customer[]" id="field3" />
  126. <label for="field3">客戶3</label>
  127. </div>
  128. <!-- .button>input:button[value="注冊"] -->
  129. <div class="button">
  130. <input class="register button" type="submit" value="注冊" />
  131. </div>
  132. </fieldset>
  133. </form>
  134. </body>
  135. </html>

實現(xiàn)效果

用戶注冊表單

注意點

  • emmet
    • 指令之間不能有空格
    • class如果設(shè)置了并列多項,用.連接每一個,第一個前面也有.
  • 表單
    • 使用 autofocus 設(shè)置默認(rèn)焦點位置
    • 只有默認(rèn)名稱沒有值的是布爾屬性:required, disabled,checked, selected
    • id 屬性前端操作用,不傳值到后臺
    • name 屬性是提交到服務(wù)器上的變量名,一組單選按框的 name 必須相同
    • 單選框可以設(shè)置默認(rèn) checked 的值,用于對應(yīng) label for 綁定,點擊 label 值會復(fù)位
    • 復(fù)選框需要返回多個值,name 不能相同,需要設(shè)置成數(shù)組:name[]
    • 復(fù)選框最好設(shè)置默認(rèn)值,否則會傳回空數(shù)組
    • input button 按鍵顯示內(nèi)容為 input value 屬性,不在input標(biāo)簽外
    • option 的default “請選擇”選項可以用屬性selected disabled 來禁用且讓用戶要選擇一項
  • 表單的

    問題點

  • 復(fù)選框選擇客戶1、客戶2或者客戶1、客戶3傳給后臺的數(shù)組似乎是一樣的,都是 array(2) { [0]=> string(2) “on” [1]=> string(2) “on” },這樣就不知道如何區(qū)分了?
批改老師:PHPzPHPz

批改狀態(tài):未批改

老師批語:
本博文版權(quán)歸博主所有,轉(zhuǎn)載請注明地址!如有侵權(quán)、違法,請聯(lián)系admin@php.cn舉報處理!
全部評論 文明上網(wǎng)理性發(fā)言,請遵守新聞評論服務(wù)協(xié)議
0條評論
作者最新博文
關(guān)于我們 免責(zé)申明 意見反饋 講師合作 廣告合作 最新更新
php中文網(wǎng):公益在線php培訓(xùn),幫助PHP學(xué)習(xí)者快速成長!
關(guān)注服務(wù)號 技術(shù)交流群
PHP中文網(wǎng)訂閱號
每天精選資源文章推送
PHP中文網(wǎng)APP
隨時隨地碎片化學(xué)習(xí)
PHP中文網(wǎng)抖音號
發(fā)現(xiàn)有趣的

Copyright 2014-2025 http://ipnx.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號

  • 登錄PHP中文網(wǎng),和優(yōu)秀的人一起學(xué)習(xí)!
    全站2000+教程免費學(xué)