H5中新表单元素(email, url, number, color, date等)在chrome和firefox中支持情况

3 篇文章 0 订阅

Html脚本如下:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<form name="myform" action="" method="get">
		E-mail: <input type="email" name="email" /><br />
		<input type="submit" />
	</form>
	<br>
	<form action="" method="get">
		URL: <input type="url" name="url" /><br />
		<input type="submit" />
	</form>
	<br>
	<form action="" method="get">
		Number: <input id="input_num" type="number" name="number" onchange="changeNum()" /><br />
		<input type="submit" />
	</form>
	<br>
	<form action="" method="get">
		Color: <input id="input_color" type="color" name="color" onchange="changeColor()" /><br />
		<input type="submit" />
	</form>
	<br>
	<form action="" method="get">
		Date: <input id="input_date" type="date" name="date" onchange="changeDate()" /><br />
		<input type="submit" />
	</form>
	<br>
	<form action="" method="get">
		Week: <input id="input_week" type="week" name="week"/><br />
		<input type="submit" />
	</form>
	<br>
	<form action="" method="get">
		Month: <input id="input_month" type="month" name="month"/><br />
		<input type="submit" />
	</form>
	<br>
	<form action="" method="get">
		Time: <input id="input_time" type="time" name="time"/><br />
		<input type="submit" />
	</form>
	<br>
	<form action="" method="get">
		DateTimeLocal: <input id="input_datetimeLocal" type="datetime-local" name="datetime_local"/><br />
		<input type="submit" />
	</form>
	<br>
	<progress value="50" max="100"></progress>
</body>
<script>
	function changeNum(){
		var num = document.getElementById("input_num").value;
		console.log("numType:"+typeof(num));
	}

	function changeColor(){
		var color = document.getElementById("input_color").value;
		console.log("color:"+color);
	}

	function changeDate(){
		var date = document.getElementById("input_date").value;
		console.log("dateType:"+typeof(date));
		console.log("date:"+date);
	}
	
</script>
</html>

Chrome(71.0.3578.98)中支持情况如下:
在这里插入图片描述
说明:
1.测试代码中所有input的type均有效。
2.对于E-mail和Url,用户如果输入不符合相关格式的内容,浏览器将拒绝提交并进行相关提示,如下图所示:
在这里插入图片描述
在这里插入图片描述
3.对于number,如果用户尝试在input上输入非数字,则浏览器会阻止将其输入input.
4.对于progress标签,属性max如果不写,value的值将会用0-1表示百分比。
5.相关的input的value的type为string格式。

Firefox(64.0)中支持情况如下:
在这里插入图片描述
1.对于email和url,如果不符合格式,浏览器也会给出相关提示并拒绝提交。
2.对于week,month和datetime-local,目前该版本火狐浏览器没有给出相关的支持。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值