HTML的表单控件

HTML的表单控件

HTML原有的

  1. 按钮

    < input type="button">

  2. 复选框

    < input type="checkbox">

    值可以设置为选中或者未选中

  3. 电子邮件

    < input type="email" >

    表单提交时,会验证数据是否符号email的规范(有@,并且@后面有内容)

  4. 选择文件

    < input type="file">

    accept属性可以设置文件指定格式

  5. 不显示的控件

    < input type="hidden">

    不显示,但是值仍然会提交到服务器

  6. 带图像的submit按钮

    < input type="image">

    如果src缺失,alt属性会显示

  7. 数字类型

    < input type="number" >

    属性:

    • value 默认显示的值
    • max 能接收到的最大值
    • min 能接收到的最小值
    • step 每次调整数字时,步数大小
  8. 密码

    < input type="password">

    值会被遮盖

  9. 单选框

    < input type="radio">

  10. 重置表单

    < input type="reset">

  11. 提交表单

    < input type="submit">

  12. 文本

    < input type="text">

    默认值,单行文本区域

  13. 周类型

    < input type="week" >

HTML5新增的

  1. 搜索类型

    < input type="search" >

    提供了快速清除的功能,输入框有个×

  2. url类型

    < input type="url" >

    提交时,验证数据是否符合url的规范(http://**)

  3. 电话号码类型

    < input type="tel" >

    在移动设备中,显示拨号键盘

  4. 范围类型

    < input type="range" >

    提供一个滑块组件,允许用户选取指定范围的值

    属性:

    • value 默认显示的值
    • max 最大值
    • min 最小值
    • step 步长
  5. 颜色类型

    < input type="color" >

    提供一个颜色拾取器

  6. 日期时间类型

    < input type="datetime-local">

  7. 时间类型

    < input type="time">

  8. 日期类型

    < input type="date" >

  9. 月份类型

    < input type="month" >

posted @ 2022-04-11 23:56  kihyun  阅读(760)  评论(0编辑  收藏  举报