Latest web development tutorials

HTML input formtarget property

HTML input Tag Reference HTML <input> tag

Examples

Form with two submit buttons will be submitted to a different target window:

<form action="demo-form.php">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="submit" value="正常提交">
<input type="submit" formtarget="_blank" value="提交到一个新的页面上">
</form>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 10, Firefox, Opera, Chrome and Safari support formtarget property.

Note: 9 and earlier versions of Internet Explorer do not support the <input> tag formtarget property.


Definition and Usage

formtarget attribute specifies the representation after the form is submitted in response to the reception where the display name or keyword.

formtarget property overrides <form> element target attribute.

Note: formtarget attribute with type = "submit" and type = "image" used in conjunction.


Differences between HTML 4.01 and HTML5

formtarget attribute is new in HTML5 attributes.

NOTE: HTML5 does not support frames and framesets. Now, _parent, _top andframenamevalues mostly used for iframe.


grammar

<input formtarget=" _blank|_self|_parent|_top| framename ">

Property Value

描述
_blank 在新窗口/选项卡中显示响应。
_self 在同一框架中显示响应(默认)。
_parent 在父框架中显示响应。
_top 在整个窗口中显示响应。
framename 在指定的 iframe 中显示响应。


HTML input Tag Reference HTML <input> tag