HTML <input> formtargetAttribute

HTML input 标签参考手册HTML <input> Tag

Examples

A form with two submit buttons that submits to different target windows:

<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="Normal submission"> <input type="submit" formtarget="_blank" value="Submit to a new page"> </form>

Try it yourself »

Browser Support

The numbers in the table specify the first browser version that fully supports the attribute.

Attribute
formtarget Yes 10.0 Yes 5.1 10.6

Definition and Usage

The formtarget attribute specifies a name or keyword that indicates where to display the response that is received after submitting the form.

The formtarget attribute overrides thetargetattribute of the <form> element.

Note:The formtarget attribute can be used with type="submit" and type="image".


Differences between HTML 4.01 and HTML5

The formtarget attribute is new in HTML5.

Note:HTML5 does not support frames and framesets. Now, _parent, _top, andframenamevalues are mostly used for iframes.


Syntax

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

Attribute Values

Value Description
_blank Displays the response in a new window/tab.
_self Displays the response in the same frame (default).
_parent Displays the response in the parent frame.
_top Displays the response in the full window.
framename Displays the response in the specified iframe.


HTML input 标签参考手册HTML <input> Tag Other Extensions