HTML knowledge point summary form elements and html knowledge point forms
Web pages cannot be purely static without any interaction functions. Most websites use form elements. The form provides a way for the visitor to interact with the website, such as user registration and logon, user message, and other functions.
The form element is only a container for retrieving data elements, and the elements in the container are called form Controls. To enable the submission of form data, you can enclose form elements in <form>. The most common form control is the input element. The form element is a block-level element.
Name attribute: Specifies the form name.
Action attribute: Specifies the page on which the form Element Data is submitted.
Method attribute: Specifies the method in which form data is submitted. The values are as follows:
(1) get: the default value. It is transmitted through url and cannot exceed 1 k at the maximum. The security is not very good.
(2) post: there is no limit on the size of the transmission, and the security is good, not transmitted through the url.
Novalidate attribute: it is a new attribute added by html5. it is required not to be verified when a form is submitted.
Autocomplete attribute: This attribute is added to html5. it specifies whether the Automatic completion function should be enabled for the form. When you start typing a field, the browser displays the entered options in the field based on the previously typed value.
Input is a powerful form control. Its main attributes include:
Text defines the input fields of a single line. You can enter text in it.
Password defines the password field. The character mask in this field
File defines the input fields and the "Browse" button for file upload.
Radio definition radio button
Checkbox definition check box
Hidden defines hidden input fields
Button definition clickable button (in most cases, it is used to start the script through JavaScript)
Image definition image form submission button
Reset defines the reset button. The reset button clears all data in the form.
Submit defines the submit button. The submit button sends the form data to the server.
Date defines the input fields of the selected day, month, and year.
Month defines the input fields of the selected month and year.
Time defines the input fields of the selected month and year.
The drop-down list is generated by using the <select> and <option> labels. The drop-down menu item is defined by the <option> label. When a form is submitted, the value Attribute value of the selected option is sent.
<Select> A tag has two important attributes:
(1) multiple: it is required that you can select multiple items from the select drop-down menu. By default, only one item can be selected from the drop-down list.
(2) size: specifies the number of items visible to the list after the drop-down list is expanded.