表单.html 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>表单</title>
  6. </head>
  7. <body>
  8. <!-- form 标签 => 表单
  9. action 规定提交表单向提交处发送的表单数据(很少使用)
  10. input 输入框 行内块元素
  11. 属性:
  12. 1.placeholder 默认的提示信息 颜色是灰色
  13. 2.value 值
  14. 3.type
  15. text 文本(默认)输入框
  16. button 按钮 (按钮名称可以自定义)
  17. submit 提交按钮
  18. reset 重置按钮
  19. radio 单选框 注意:name值必须相同才生效
  20. checkbox 复选框(多选框)disabled 禁止选择 checked 选中状态
  21. password 密码
  22. -->
  23. <form action="">
  24. <input type="text" placeholder="请输入您的电话号码" value="****">
  25. <input type="submit">
  26. <input type="reset">
  27. <input type="radio" name="same">男
  28. <input type="radio" name="same">女
  29. <input type="checkbox" disabled>音乐
  30. <input type="checkbox" checked>美术
  31. <input type="checkbox">跳舞
  32. <input type="checkbox">口才
  33. <input type="password">
  34. <!-- 下拉框
  35. select 表单中的控件
  36. option 表单中的选项
  37. select 和 option 共同组成下拉框 缺一不可
  38. selected 默认选中
  39. disabled 禁止选中
  40. -->
  41. <select>
  42. <option value="1">1</option>
  43. <option value="2" selected>2</option>
  44. <option value="3" disabled>3</option>
  45. <option value="4">4</option>
  46. </select>
  47. <!-- 文本域 textarea
  48. rows 行
  49. cols 列
  50. maxlength 可以输入的最大长度
  51. -->
  52. <textarea cols="15" rows="8" maxlength="10"></textarea>
  53. </form>
  54. </body>
  55. </html>