HTML button formtarget property
Examples
Two submit buttons, first submit button using the default target ( "_self") submitted data, the second submit button to submit data to a new window (target = "_ blank"):
<form action="demo_form.html" method="get">
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>
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"
Browser Support
Internet Explorer 10, Firefox, Opera, Chrome, and Safari support formtarget property.
Note: Internet Explorer 9 and earlier versions do not support IE formtarget property.
Definition and Usage
formtarget attributes specified after the form is submitted in response to the display where it is. formtarget property overrides form element target attribute.
This attribute type = "submit" used in conjunction.
Differences between HTML 4.01 and HTML5
formtarget property is new in HTML 5 attributes.
NOTE: HTML5 does not support frames and framesets. Now, parent, top and framename values mostly used for iframe.
grammar
<button type = "submit" formtarget = "_ blank | _self | _parent | _top | framename">
Property Value
value | description |
---|---|
_blank | New Window / card option will submit the form to the document. |
_self | In the same framework in the form submitted to the document. (default) |
_parent | Forms will be submitted to the parent frame in the document. |
_top | Forms will be submitted to the entire document window. |
framename | In the form submitted to the frame specified in the document. |
HTML <button> tag