HTML的表单控件
HTML原有的
-
按钮
< input type="button">
-
复选框
< input type="checkbox">
值可以设置为选中或者未选中
-
电子邮件
< input type="email" >
表单提交时,会验证数据是否符号email的规范(有@,并且@后面有内容)
-
选择文件
< input type="file">
accept属性可以设置文件指定格式
-
不显示的控件
< input type="hidden">
不显示,但是值仍然会提交到服务器
-
带图像的submit按钮
< input type="image">
如果src缺失,alt属性会显示
-
数字类型
< input type="number" >
属性:
- value 默认显示的值
- max 能接收到的最大值
- min 能接收到的最小值
- step 每次调整数字时,步数大小
-
密码
< input type="password">
值会被遮盖
-
单选框
< input type="radio">
-
重置表单
< input type="reset">
-
提交表单
< input type="submit">
-
文本
< input type="text">
默认值,单行文本区域
-
周类型
< input type="week" >
HTML5新增的
-
搜索类型
< input type="search" >
提供了快速清除的功能,输入框有个×
-
url类型
< input type="url" >
提交时,验证数据是否符合url的规范(http://**)
-
电话号码类型
< input type="tel" >
在移动设备中,显示拨号键盘
-
范围类型
< input type="range" >
提供一个滑块组件,允许用户选取指定范围的值
属性:
- value 默认显示的值
- max 最大值
- min 最小值
- step 步长
-
颜色类型
< input type="color" >
提供一个颜色拾取器
-
日期时间类型
< input type="datetime-local">
-
时间类型
< input type="time">
-
日期类型
< input type="date" >
-
月份类型
< input type="month" >