8_表单元素.html 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <!DOCTYPE html>
  2. <html lang="en">
  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>Document</title>
  8. </head>
  9. <body>
  10. <!-- 表单 -->
  11. <form action="xx">
  12. <!--文本框 type="text"-->
  13. 用户名:
  14. <input type="text"><br>
  15. <!-- 密码框 type=“password" -->
  16. 密码:
  17. <input type="password"><br>
  18. <!-- 单选框 type="radio" 单选需要有一个相同的name属性-->
  19. 性别:
  20. <input type="radio" name="sex">男
  21. <input type="radio" name="sex">女 <br>
  22. <!--复选框 type=checkbox 需要有一个相同的name属性 -->
  23. 爱好:
  24. <input type="checkbox" name="hobby">唱跳
  25. <input type="checkbox" name="hobby">篮球
  26. <input type="checkbox" name="hobby">敲代码 <br>
  27. <!-- 下拉列表 -->
  28. 学校:
  29. <select >
  30. <option value="">理工</option>
  31. <option value="">黑工程</option>
  32. <option value="">黑大</option>
  33. </select>
  34. <br>
  35. <!-- 文本域 -->
  36. 备注:
  37. <textarea cols="30" rows="10"></textarea><br>
  38. <!-- 按钮
  39. type="submit" 提交按钮 自动提交form表单
  40. button普通按钮
  41. -->
  42. <input type="submit">
  43. <input type="reset">
  44. <input type="button" value="确定">
  45. </form>
  46. <hr color="red">
  47. </body>
  48. </html>