Tenth chapter FORM Element "Medium"
First, type attribute summary
1, type is text: a single line of text, the default behavior;//<input type= "Text" >
Text is the default value, renders a textbox that can enter any character, and provides additional properties:
| —————————————————————————————— |
| Property name | Description |
| List | Specifies the DataList element that provides a suggested text box with a value of the ID value of the DataList element
| Maxlegth | Set the maximum length of text box characters |
| Pattern | Regular expression for Input validation |
| Placeholder | Input text hint (in the input box, there is no self-character when you set the message)
| readonly | text box in read-only state |
| Disabled | text box is disabled |
| Size | Set Text box width |
| Value | Set the text box initial value (there is an initial value in the box, you can also change the input other values)
| Required | Indicates that the user must enter a value that cannot be validated by the input
| —————————————————————————————— |
Example: <form>
<input type= "text" list= "abc" >
</form>
<datalist id= "abc" >
<option value= "1" > Apple </option>
<option value= "2" > Orange </option>
<option value= "3" label= "banana" >
<option value= "Pineapple" >
</datalist>
2. When type is password: the password box of the hidden character, (the input character turns into a black circle) (the same as the extra property above)
3, type Serch: After the text box will display a fork to cancel the search content, the additional properties and text; (Firefox does not support)
4, type is number (can only enter numbers, enter the letter not to submit)/range (enter the range of numbers):
| —————————————————————————————— |
| Property name | Description |
| List | Specifies the DataList element that provides a suggested text box with a value of the ID value of the DataList element
| Min | Set Acceptable minimum values |
| Max | Set an acceptable maximum value |
| readonly | Set text box read-only |
| Required | Indicates that the user must enter a value that cannot be validated by the input
| Value | Set the text box initial value (there is an initial value in the box, you can also change the input other values)
| Step | Specify the step size of the upper and lower adjustment values |
| —————————————————————————————— |
5. When type is Date series://<input type= "date/month/time/week/datetime/datetime-local" > (Additional attributes and number)
6. When the type is color: The text box gets the color function
7. Type is Checkbox/radio:
(1) Checked set check box, whether the radio box is checked status;
(2) required indicates that the user must tick, otherwise it cannot pass the verification;
(3) The Value setting check box, the Radio box check the status of the submission of data, the default is on;
Music <input type= "checkbox" Name= "Music" value= "1" >} You can select one or more
Sports <input type= "checkbox" Name= "Sport" value= "2" >}
<input type= "Radio" name= "Sex" value= "1" checked> male} can only select one, point one, the other will be automatically canceled, and name must be the same.
<input type= "Radio" name= "Sex" value= "2" > female} checked default preferred.
8, the type is Submit/reset/button: (The 10th chapter "on" One, 7)
(1) Submit to generate a Submit button;
(2) Reset generates a reset button;
(3) button to generate a normal pushbutton;
9. When the type is image: Generate a Picture button, click Implement Submit function. <input type= "image" src= "Picture name" >
Additional properties: Src/alt (provides a textual description of the picture)/width/height
10, type for email (email format, support is better)/tel (phone format, basic not supported)/url (network format, support General)
11, type hidden: Generate a hidden file, generally used for form submission when the associated primary key ID is submitted, and this data as a hidden existence.
12. When type is file: Upload control for file upload.
Additional properties
Accept specifies that the HTML type be accepted
Required indicates that the user must enter a value that cannot be verified by the input
11.HTML form Element "Medium"