New FORM element for HTML 5:
HTML 5 owns several elements and attributes that involve a form.
This chapter describes the following new form elements:
DataList
Keygen
Output
Browser support
Input type IE Firefox http://www.aliyun.com/zixun/aggregation/10963.html ">opera Chrome Safari DataList no no 9.5 No no no keygen no no 10.5 3.0 No output no no no 9.5 no no
DataList element
The DataList element sets the list of options for the input field.
The list is created from the option element within DataList.
To bind DataList to an input field, refer to the DataList ID with the list property of the input field:
Instance
Webpage: <input type= "url" list= "url_list" name= "link"/>
<datalist id= "Url_list" >
<option label= "W3school" value= "http://www.W3School.com.cn"/>
<option label= "Google" value= "http://www.google.com"/>
<option label= "Microsoft" value= "http://www.microsoft.com"/>
</datalist>
Try it yourself, the code is as follows:
<! DOCTYPE html>
<html>
<body>
<form action= "/example/html 5/demo_form.asp" method= "Get" >
Webpage: <input type= "url" list= "url_list" name= "link"/>
<datalist id= "Url_list" >
<option label= "W3school" value= "http://www.w3school.com.cn"/>
<option label= "Google" value= "http://www.google.com"/>
<option label= "Microsoft" value= "http://www.microsoft.com"/>
</datalist>
<input type= "Submit"/>
</form>
</body>
</html>
Tip: Option element always sets the Value property.