1. 程式人生 > >H5新增表單type屬性

H5新增表單type屬性

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<form action="">
			使用者名稱:<input type="text" /><br>		
			密碼:<input type="password" /><br>
			郵箱:<input type="email" /><br><!--提供了預設的電子郵箱的完整驗證,提交時驗證,必須包含@必須包含域名,如果不能滿足驗證則會阻止當前的資料提交-->
			電話:<input type="tel" /><br>	<!--目的在移動端切換到數字鍵盤,意味著數字鍵盤限制了使用者只能輸入數字-->
			網址:<input type="url" /><br>	<!--提供了驗證只能輸入合法網址驗證  必須包含http://-->
		           數字:<input type="number" value="10" max="20" min="0" /><br><!-- 只能輸入數字(包含小數點)不能輸入其他字元  value預設值max最大值min最小值-->
		           	
		    請輸入商品名稱:<input type="search" /><br><!--人性化的輸入體驗,右邊可以刪除,可刪除全部-->
		    範圍:<input type="range" max="100" min="0" value="50"/><br><!--max min value不寫預設也是50-->
		  顏色:<input type="color" /><br><!--value值就是其顏色 可以選擇顏色 可以通過js獲取該value值為該顏色-->
		  	時間:<input type="time" /><br><!--時分秒-->
		  	日期:<input type="date" /><br>		  		
		  	<!--年月日 datetime大多瀏覽器不支援-->
		  	<!--年月日時分秒-->
		  	日期時間:<input type="datetime-local" /><br>
		  	月:<input type="month" /><br>
		  	<!---->
		  	周:<input type="week" /><br>
			<input type="submit" value="提交" />
		</form>
		
	</body>
</html>