HTML5表单中的input新标签与老标签的type类型
来源:原创
时间:2015-08-29
作者:脚本小站
分类:CSS/HTML
HTML5中表单的input标签增加了很多实用的新类型,支持的浏览器会自动对类型进行验证,省去了js。
input 原有属性:
button 按钮
checkbox 单选框
radio 单选圈
file 文件
hidden 隐藏
image 图像
password 密码
reset 重置
submit 提交
text 文本
html5中input新标签
required 必须的 <input type="" required />此标签的值必须填写
search 搜索
datatime 时间
date 日期
time 时间
month 月份
week 周
url URL
range 等级滑动块
min="0" 滑动的最小值
max="100" 滑动的最大值
step="10" 每隔几个为一格
color 颜色
number 数字 step="0.01" min="0.01"(step 输入小数时加入 min="最小数字" )
email 邮箱
例:
<input type="date" name="atime" /><!--浏览器会自动验证日期类型-->