HTML5为input的type类型增加了多种枚举值,用来表达不同的意思,同事具有验证功能,如果格式不对,浏览器将原始提供错误提示,堪称超级牛X啊,具体如下:
Keyword | Data type |
hidden | 任意字符 |
text | 单行文本 |
search | 单行文本 |
tel | 单行文本 |
url | 绝对地址 |
| 一个或多个email地址 |
password | 单行文本 |
datetime | 带有时区的时间 |
date | 无时区的年月日时间 |
month | 无时区的年月 |
week | 无时区的周数 |
time | 无时区的时间(小时,分钟,秒,毫秒) |
datetime-local | 无时区的日期与时间 |
number | 数字值 |
range | 范围:<input type="range" min=0 max=100 step=20 value=50> |
color | 8-bit表示的颜色 |
checkbox | checkbox |
radio | radio |
file | 文件 |
submit | 提交按钮 |
image | 图片按钮 |
reset | n/a |
button | n/a |
参考资料:http://www.mhtml5.com/resources/html5%E6%95%99%E7%A8%8B%EF%BC%88%E5%85%AD%EF%BC%89-html5-input%E7%B1%BB%E5%9E%8B
学习至此,大叔发现mhtml5网站上已经有很多现成的资料了,所以如下的一些新元素请大家自行参考该网站的资料学习,大叔将着重继续学习HTML5在现有元素上的更新改变。
- figure元素
- figcaption元素
- track元素
- embed元素
- mark元素
- progress元素
- time元素
- ruby, rt和rp元素
- bdi元素
- wbr元素
- canvas元素
- command元素
- details元素