HTML slt;button and form property
The form property can dictate which form the element belongs to, refer to the following example:
Submit buttons outside the form (but still part of the form):
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
</form>
<p>下面的按钮是在表单元素外,但仍是表单的一部分</P>
<button type="submit" form="nameform" value="提交">提交</button>
Try it out . . .
Browser support
Form properties are supported by all major browsers except Internet Explorer.
Definitions and usages
The form property states that a button belongs to one or more forms.
Tip: The value of the form property must be the id of the form to which the button belongs.
Tip: To refer to more than one form, use a space-separated list.
The difference between HTML 4.01 and HTML5
The form property is a new property of HTML5.
Grammar
The property value
Value | Describe |
---|---|
form_id | The id of the form to which the button belongs. To refer to more than one form, use a space-separated list. |
HTML slt;button-and-label