HTML slt;button> formtarget property
The formtarget property can specify where the submitted HTML form appears, and the following example uses the property in detail:
Two submit buttons, the first submit button uses the default target ("_self") to submit data, and the second commit button submits the data to a new window (target "_blank"):
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<button type="submit" >提交</button>
<button type="submit" formtarget="_blank">提交到一个新窗口或选项卡</button>
</form>
Try it out . . .
Browser support
Internet Explorer 10, Firefox, Opera, Chrome, and Safari support formtarget properties.
Note: Formtarget properties are not supported by Internet Explorer 9 and earlier versions of IE.
Definitions and usages
The formtarget property specifies where the response is displayed after the form is submitted. The formtarget property overrides the target property of the form element.
This property is used in conjunction with type "submit".
The difference between HTML 4.01 and HTML5
The formtarget property is a new property in HTML 5.
Note: H TML5 does not support frames and frame sets. Parent, top, and framename values are now mostly used for iframe.
Grammar
The property value
Value | Describe |
---|---|
_blank | Submit the form to the document in a new window/tab. |
_self | Submit forms to documents in the same framework. (Default) |
_parent | Submit the form to the document in the parent framework. |
_top | Submit the form to the document throughout the window. |
framename | Submit the form to the document in the specified framework. |
HTML slt;button-and-label