HTML5 新的 Input 类型
来源:互联网 发布:js利用apply实现bind 编辑:程序博客网 时间:2024/05/18 03:41
HTML5 拥有多个新的表单输入类型。这些新特性提供了更好的输入控制和验证。
介绍这些新的输入类型:
- url
- number
- range
- Date pickers (date, month, week, time, datetime, datetime-local)
- search
- color
- telephone
- color
在提交表单时会自动验证email的格式,opera浏览器中必须有name属性,否则不起作用
效果:
URL
效果:
NUMBER
可以限制输入的数字,step为上一个数字与下一个数字的间隔
效果:
RANGE
滑动条,能过选择性的对限制范围内的数值进行设置
效果:
Date Pickers(数据检出器)
HTML5 拥有多个可供选取日期和时间的新输入类型:
- date - 选取日、月、年
- month - 选取月、年
- week - 选取周和年
- time - 选取时间(小时和分钟)
- datetime - 选取时间、日、月、年(UTC 时间)
- datetime-local - 选取时间、日、月、年(本地时间)
This is how Opera renders <input type="date">
:
If you need a time to go with that date, Opera also supports <input type="datetime">
:
If you only need a month + year (perhaps a credit card expiration date), Opera can render a <input type="month">
:
Less common, but also available, is the ability to pick a specific week of a year with <input type="week">
:
Last but not least, you can pick a time with <input type="time">
:
以上都是从关于时间的都是网上找到,自己做的是这样的
其中图片中显示的UTC为世界统一时间
SEARCH
<datalist id="searchlist">
<option value="http://www.google.com" label="Google" />
<option value="http://www.yahoo.com" label="Yahoo" />
<option value="http://www.bing.com" label="Bing" />
</datalist>
这里的datalist相当于下拉列表,可以进行选择
效果:
TELEPHONE
可输入一个电话号码
效果:
COLOR
可以获取颜色
效果:
以上个人图片效果显示均来自opera浏览器
下面图片时各主流浏览器对input的支持情况:
input标签表单类型的显示情况:
参考网站:A Form of Madness
HTML5
W3CSchool 中文
how to intranet
转载:http://www.cnblogs.com/shenzhoulong/archive/2011/02/13/1952919.html
- HTML5 新的 Input 类型
- HTML5 新的 Input 类型
- HTML5新的input类型
- HTML5 新的 Input 类型
- HTML5 新的 Input 类型
- HTML5新的Input类型
- HTML5 新的 Input 类型
- HTML5 新的 Input 类型
- HTML5 新的 Input 类型
- 转:HTML5 新的 Input 类型
- HTML5中新的input类型
- HTML5 的input类型
- HTML5 form input 文本框新加的类型
- HTML5_新的input类型
- HTML5 中input的新属性
- new : HTML5 中input的新属性
- WEB前端 -- input类型、fieldset、HTML5新标签
- HTML5新增的INPUT输入类型
- 毕业后的套路
- Dom解析Html文档中的元素
- HTML DOM
- DOM HTML
- 性能测试总结
- HTML5 新的 Input 类型
- 获取select中option中的文本节点
- 利用动态类型和Json.net创建自定义数据
- 一道和打印字符有关的程序题
- 编写一个方法用于验证指定的字符串是否为反转字符,返回true和false。请用递归算法实现
- Win7 x64 旗舰版下重新注册IIS7.5
- 有12个问题你想过了吗?
- 低碳生活
- ---------SQL 2005如何更改排序规则---------------