<form>
Create an HTML form
Property:
action indicates where the browser should send the user-filled data when the form is submitted
method is used to specify how the form data is sent to the server. Allowed values are get and post two
The enctype is used to specify the data encoding that the browser sends to the server. There are three available values for this property
Value |
Description |
application/x-www-form-urlencoded |
This is the default encoding method. It cannot be used to upload files to the server |
Multipart/form-data |
This encoding is used to upload files to the server |
Text/plain |
This encoding varies by browser. See below for instructions |
- Application/x-www-form-urlencoded is the default encoding, which applies to various types of forms, except that it cannot be used to upload files to the server. The data format used for this encoding is as follows:
Name= Wang Nima &age=18
- Multipart/form-data is mainly used to upload files to the server. Its coding format is more complex
- Text/plain different browsers have different encoding methods, please use with caution. For example, the data encoding form for Text/plain in Firefox is in the following form:
Name= Wang Nima age=18
And in Chrome, it's the same as the application/x-www-form-urlencoded code.
AutoComplete Indicates that the browser is allowed to autofill the form, which has two property values: on and off. The default is on,off to turn off the browser auto-fill form feature
Target has the same target function as the a element, which sets the way in which the browser feedback information is displayed. The property values are as follows:
Value |
Description |
_blank |
Display the browser feedback information in a new window (or a new tab in the browser) |
_parent |
Display browser feedback information in the parent window group |
_self |
Display the browser feedback information in the current window (this is the default behavior) |
_top |
Display browser feedback information in the top-level window |
<frame> |
Display the browser feedback information in the specified frame |
name is used to set a unique identifier for the form.
<input>
Used to collect user information
Property:
Property |
Value |
Describe |
Accept |
Mime_type |
Specifies the type of file submitted through the file. |
Alt |
Text |
Define alternate text for image input |
AutoComplete |
On/Off |
Same as the AutoComplete function of form forms |
Autofocus |
Autofocus |
Specifies whether the input field receives focus when the page is loaded |
Checked |
Checked |
Specifies that this input element should be selected when it is first loaded |
Disabled |
Disabled |
Disable INPUT element |
Form |
FromName |
Specify which form input belongs to |
FormAction |
Url |
Override the form's Action property |
Formenctype |
|
Overriding the Enctype property of a form |
FormMethod |
|
Override the form's Method property |
Height |
Datalist-id |
DataList of predefined options that contain input fields |
Max |
Number |
Specify the maximum value of the input field |
Min |
Number |
Specifies the minimum value of the input field |
Pattern |
Regexp=pattern |
Regular expression that specifies the input field |
Placeholder |
Text |
Provides tips to help users fill in input fields |
ReadOnly |
ReadOnly |
Specifies that the input field is read-only |
Step |
Number |
Specify the step size of input |
Type |
button CheckBox File Hidden Image Password Radio Reset Submit Text Number Range Date Color |
Specifies the element type of input |
<label>
Provide a description for each element in the form
Property:
for specifies which element the label is bound to, and the value is the element ID
from specifies which form element belongs to, and the value is the form element ID
"HTML5" form elements