html5时间控件的值是什么数据类型

html-css08

html5时间控件的值是什么数据类型,第1张

Input 类型 - Date Pickers(日期选择器)

HTML5 拥有多个可供选取日期和时间的新输入类型:

date - 选取日、月、年

month - 选取月、年

week - 选取周和年

time - 选取时间(小时和分钟)

datetime - 选取时间、日、月、年(UTC 时间)

datetime-local - 选取时间、日、月、年(本地时间)

Date: <input type="date" name="user_date" />

应该是data-属性吧?这个方法比较多,用字符串截取(split)或者正则都可以实现。下面以字符串截取为例:

var AA=$("a.eee").attr("data-role").split("-")

$("a.eee").click(function(){

   $(this).attr("data-role",AA[0] + AA[1] + AA[2])

   alert($("a.eee").attr("data-role"))

}) <a class="eee" data-role="2015-05-05">2015-05-05</a>

点击这个a标签就能将2015-05-05改成20150505了。

表单中新增的控件(type属性)

email: 提交表单时检测值是否是一个电子邮件格式

url: 提交表单时检测值是否是一个url格式

date: 年-月-日格式的控件

time: 时:分格式的控件

datetime: 年-月-日 时:分 格式的控件(UTC时间)

datetime-local: 年-月-日 时:分 格式的控件(本地时间)

month: 年-月格式的控件

week: 年-周数格式的控件

number: 数字输入框

<input type="number" name="" id="" value="60" max="100" min="0" />

range: 选择区域

<input type="range" name="" id="" value="60" max="100" min="0" />

tel: 电话输入框

search: 用于搜索

color: 调用系统选色器

新增控件属性:

placeholder: 占位符,输入框提示信息

<input type="text" autofocus placeholder=''/>

required: 该input为必填项

autofocus: 在页面加载时,域自动地获得焦点

autocomplete="off/on":可以记录输入信息

必须有name属性 必须提交过

off==>关闭 on==>打开

<input type="tel" name="user" id="" value="" autocomplete="on"/>

pattern: 正则验证

<input type="tel" pattern="[0-9]{7,12}"/>

min/max: input能输入的最小/最大字节的长度

step: 针对number和range类型,每次递增step的值

list: 指定一个datalist,作为下拉提示单