待补充
The button element represents a button labeled by its contents.
The element is a button.
The type attribute controls the behavior of the button when it is activated. It is an enumerated attribute. The following table lists thekeywords and states for the attribute — the keywords in the left column map to the states in the cell in the second column on the same row as the keyword.
| Keyword | State | Brief description |
|---|---|---|
| submit | Submit Button | Submits the form. |
| reset | Reset Button | Resets the form. |
| button | Button | Does nothing. |
The missing value default and invalid value default are the Submit Button state.
If the type attribute is in the Submit Button state, the element is specifically a submit button.
Constraint validation: If the type attribute is in the Reset Button state or the Button state, the element is barred from
constraint validation.
A button element element’s activation behavior is:
Example
The following button is labeled “Show hint” and pops up a dialog box when activated:
<button type=button
onclick="alert('This 15-20 minute piece was composed by George Gershwin.')">
Show hint
button>