點評:以前忽略了HTML5的強大功能,誰知有了它數據大部分都不需要自己驗證,顯示日曆也不需要插件啦,一些小功能分享給大家
1.Email輸入框,自動驗證Email有效性。<!DOCTYPE HTML>
<html>
<body>
<form action="#" method="get">
E-mail: <input type="email"/>
<input type="submit"/>
</form>
</body>
</html>
2.number數字輸入,驗證正確,可以設置開始結束位。
<!DOCTYPE HTML>
<html>
<body>
<form action="#" method="get">
<input type="number" step="5" min="5"max="20" value="0"/>
<input type="submit"/>
</form>
</body>
</html>
3.URL輸入框,可以驗證URL輸入的有效性。
<form action=# method=get> URL: <input type=url name=user_email/><br /> <input type=submit/></form>
4.Date pickers (date, month, week, time, datetime, datetime-local)選擇框,可以選擇日期,時間,月,週。
<!DOCTYPE HTML>
<html>
<body>
<form action="#" method="get">
Date: <input type="date"/>
month : <input type="month"/>
week: <input type="week"/>
time: <input type="time"/>
datetime: <input type="datetime"/>
datetime-local : <input type="datetime-local"/>
<input type="submit"/>
</form>
</body>
</html>
5.datalist輸入選擇。
<!DOCTYPE HTML> <html>
<body>
<form action="#" method="get">
Webpage: <input type="url" list="url_list"value="fdf"/>
<datalist>
<option label="W3School"value="http://www.w3school.com.cn"/>
<option label="Microsoft" value="http://www.microsoft.com"/>
</datalist><input type="submit"/>
</form>
</body>
</html>