Blogger Information
Blog 16
fans 0
comment 0
visits 12289
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
from用户注册表单
大碗宽面
Original
469 people have browsed it

html表单常用标签

text 文本

password 密码

radio 单选框

checkbox 复选框

下拉框 select +下拉列表option

自定义下拉框 datalist+option


代码:

  1. <h2>用户注册</h2>
  2. <form action="1.php" method="POST" style="display: grid; gap: 0.5em">
  3. <fieldset>
  4. <legend style="text-align: center">必填项</legend>
  5. <div>
  6. <label for="username">账号:</label>
  7. <!-- name属性是传递给 -->
  8. <input type="text" name="username" id="username" placeholder="不少于8位" required autofocus value="admin" />
  9. </div>
  10. <div>
  11. <label for="pwd">密码:</label>
  12. <input type="password" name="pwd" id="pwd" placeholder="不少于六位" required />
  13. </button>
  14. </div>
  15. <div>
  16. <label for="email">邮箱:</label>
  17. <input type="email" name="email" id="email" placeholder="php@email.com" required />
  18. </div>
  19. </fieldset>
  20. <!-- 单选框 -->
  21. <div>
  22. <label for="secret">性别:</label>
  23. <input type="radio" id="male" name="sex" value="male" /><label></label>
  24. <input type="radio" id="female" name="sex" value="female" /><label></label>
  25. <input type="radio" id="secret" name="sex" value="secret" checked /><label>保密</label>
  26. </div>
  27. <!-- 复选框 -->
  28. <div>
  29. <label for="secret">性别:</label>
  30. <input type="checkbox" id="game" name="hobby[]" value="game" checked /><label for="game">游戏</label>
  31. <input type="checkbox" id="trave" name="hobby[]" value="trave" /><label for="trave">旅游</label>
  32. <input type="checkbox" id="shoot" name="hobby[]" value="shoot" checked /><label for="shoot">摄影</label>
  33. </div>
  34. <!-- 下拉框 -->
  35. <div>
  36. <select name="level">
  37. <option value="1">青铜</option>
  38. <option value="2">白银</option>
  39. <option value="3">黄金</option>
  40. <option value="4" selected>铂金</option>
  41. </select>
  42. </div>
  43. <!-- 自定义下拉框 datalist +option -->
  44. <div>
  45. <label for="">搜索关键字:</label>
  46. <input type="search" id="search" list="keywords" />
  47. <datalist id="keywords">
  48. <option value="html">html</option>
  49. <option value="css">css</option>
  50. <option value="js">js</option>
  51. <option value="javascript">javascript</option>
  52. </datalist>
  53. </div>
  54. <!-- button默认值是submit提交 -->
  55. <button>提交</button>
  56. <button type="reset">重置</button>
  57. </form>
Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:作业要保证完整性,否则无法确定你的作业是否完成
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post