文档介绍:HTML5 拥有多个新表单输入类型。这些新特征提供了愈加好输入控制和验证。本文将介绍HTML5 新 Input 类型。
AD:
HTML5 拥有多个新表单输入类型。这些新特征提供了愈加好输入控制和验证。
介绍这些新输入类型:
email
url
number
range
Date pickers (date, month, week, time, datetime, datetime-local)
search
color
telephone
color
EMAIL
<input type="email" /> 
在提交表单时会自动验证email格式
效果:
URL
<input type="url" /> 
在提交表单时会自动验证url格式
效果:
NUMBER
<input type="number" max="9" min="0" step="2"/> 
能够限制输入数字,step为上一个数字和下一个数字间隔
效果:
RANGE
<input type="range"  min="1" max="10" /> 
滑动条,能过选择性对限制范围内数值进行设置
效果:
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">:
地址:
以上全部是从相关时