English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The 'formtarget' attribute specifies a name or keyword that indicates where the received response is displayed after submitting the form, which will override the 'target' attribute of the '<form>' element.
A form with two submit buttons and different target windows:
<!DOCTYPE html> <html> <head> <title>HTML: <input> formtarget attribute - 基础教程网(oldtoolbag.com)</title> <body> <form action="action_page.php"> First name: <input type="text" name="fname"><br> Last name: <input type="text" name="lname"><br> <input type="submit" value="Submit as normal"> <input type="submit" formtarget="_blank" value="Submit to a new window/tab"> </form> </body> </html>Test to see ‹/›
IEFirefoxOperaChromeSafari
Internet Explorer 10Firefox, Opera, Chrome, and Safari support the 'formtarget' attribute.
Note:Internet Explorer 9 Previous versions do not support the 'formtarget' attribute of the '<input>' tag.
The 'formtarget' attribute specifies a name or keyword that indicates where the received response is displayed after submitting the form.
The formtarget attribute overrides the <form> element's target attribute.
Note:The formtarget attribute can be used with type="submit" and type="image".
The formtarget attribute is an HTML5 new attributes added
Note:HTML5Frames and framesets are not supported. The _parent, _top, and framename values are now mainly used for iframes.
<input formtarget="_blank|_self|_parent|_top|framename">
Value | Description |
---|---|
_blank | In a new window/Display the response in the tab. |
_self | Display the response in the same frame (default). |
_parent | Display the response in the parent frame. |
_top | Display the response in the entire window. |
framename | Display the response in the specified iframe. |