Comment: HTML5 has several elements and attributes involving forms. Here are the new form elements, datalist elements, keygen elements, output elements and their usage examples. Interested friends can refer to it. I hope it will be helpful to you.
HTML5 has several elements and attributes involving forms.
This chapter introduces the following new form elements:
•datalist
•keygen
•output
Browser support
Input typeIEFirefoxOperaChromeSafari
datalistNoNo9.5NoNo
keygenNoNo10.53.0No
outputNoNo9.5NoNo
datalist element
The datalist element specifies a list of options for the input field.
The list is created with the option element in the datalist.
To bind datalist to the input domain, please refer to the id of the datalist using the list attribute of the input domain:
Example
Webpage: <input type="url" list="url_list" />
<datalist>
<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
Tip: The option element must always set the value attribute.
keygen element
The function of the keygen element is to provide a reliable way to verify users.
The keygen element is a key-pair generator. When submitting the form, two keys are generated, one is the private key and the other is the public key.
The private key is stored in the client, and the public key is sent to the server. The public key can be used to later verify the user's client certificate.
Currently, the browser's poor support for this element is not enough to make it a useful security standard.
Example
<form action="demo_form.asp" method="get">
Username: <input type="text" />
Encryption: <keygen />
<input type="submit" />
</form>
Try it yourself
output element
The output element is used for different types of outputs, such as calculation or script output:
Example
<output onforminput="resCalc()"></output>