Heim >Web-Frontend >HTML-Tutorial >HTML-Formulareingabetyp
Die
Der -Tag ist ein wichtiges Element eines HTML-
Type | Description | Format | Example |
button | Used to define a push button with the text of the button being the value of the value attribute. |
|
|
checkbox | Used to define a checkbox allowing users to select/deselect its values. |
|
|
file | Used to define a file upload feature on the local system with the accept attribute being used to restrict the file types for upload. |
<input type="file" name="newfile"> |
|
hidden | Used to hide a control whose value will be submitted on the server. There is an example in the next column, but it’s hidden! | ||
image | A graphical submit button — displaying an image defined with the src attribute. The alt attribute displays if the image src is missing. |
|
|
password | Used to define a single-line text field whose value is obscured, and it will also alert the user if the site is not secure |
|
|
radio | Used to define a radio button and select a single value out of multiple. |
|
|
reset | Used to define a button to reset the form values to its defaults. |
|
|
submit | Used to define a submit button for the form. |
|
|
text | Used to define a text field in the form. |
|
Type | Description | Format | Example |
color | Used to define the color of the elements in an HTML form. It takes a hexadecimal input. |
|
|
datetime-local | Used to define an element for date and time in the HTML form with opening a date picker or numeric wheels for the month, day, and year, when used in supported browsers. |
|
|
Used to define a text field for email which has all the predefined validations done for checking an email. |
|
||
date | Used to define a date picker for the HTML form. |
|
|
number | Used to input numbers in the HTML form by displaying a spinner and adding default validation when used in supported browsers. |
|
|
range | Used to define a range in the HTML form. |
|
|
search | Used to define single-line text fields for entering search strings. |
|
|
tel | Used to define a telephone entering field within an HTML form. |
|
|
time | Used to define a field for entering time in HTML form |
|
|
url | Used to define a text field for entering a url in the HTML form with all its validations being performed automatically.
|
|
|
week | Used to define a text field for entering the week-year number and a week number with no time zone. |
|
|
datetime | Used to define a text field for entering a date and time (hour, minute, second, and fraction of a second) based on the UTC time zone. |
|
Der folgende Abschnitt enthält eine Tabelle mit allen relevanten Attributen sowie einer kurzen Beschreibung. Auf diese Tabelle folgt eine Liste, die jedes Attribut ausführlicher beschreibt und angibt, mit welchen Eingabetypen es verknüpft ist. Diejenigen, die den meisten oder allen Eingabetypen gemeinsam sind, werden unten detaillierter definiert.
Attribute | Types |
1. accept | file |
2. alt | image |
3. autocomplete | all |
4. autofocus | all |
5. capture | file |
6. checked | radio, checkbox |
7. dirname | text, search |
8. disabled | all |
9. form | all |
10. formaction | image, submit |
11. formenctype | image, submit |
12. formmethod | image, submit |
13. formnovalidate | image, submit |
14. formtarget | image, submit |
15. height | image |
16. list | almost all |
17. max | numeric types |
18. maxlength | password, search, tel, text, url |
19. min | numeric types |
20. minlength | password, search, tel, text, url |
21. multiple | email, file |
22. name | all |
23. pattern | password, text, tel |
24. placeholder | password, search, tel, text, url |
25. readonly | almost all |
26. required | almost all |
27. size | email, password, tel, text |
28. src | image |
29. step | numeric types |
30. type | all |
31. value | all |
32. width | image |
Mit Hilfe der neuen HTML5-Formulareingabetypen können wir das Benutzererlebnis verbessern, eine zukunftssichere Anwendung erstellen und die Codierung für Entwickler etwas einfacher machen. Die Unterstützung dieser neuen Formulareingabetypen ist besonders bei mobilen Geräten mit Tastaturen stark ausgeprägt. Diese Eingabetypen sind aus Gründen der Benutzerfreundlichkeit sicher und bieten dem Benutzer außerdem zusätzlichen Nutzen.
Das obige ist der detaillierte Inhalt vonHTML-Formulareingabetyp. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!