English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
This article introduces the HTML form target attribute, which specifies a name or keyword indicating where the received response should be displayed after submitting the form. An online example demonstrates how to use the HTML form target attribute, browser compatibility, syntax definition, and detailed information about its attribute values.
Submit a form that opens in a new window or tab, displaying the received response in the new window or tab:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>HTML <form> target Attribute Usage-Basic Tutorial(oldtoolbag.com)</title> </head> <body> <form action="action_page.php" method="get" target="_blank"> First name: <input type="text" name="fname"><br> Last name: <input type="text" name="lname"><br> <input type="submit" value="Submit"> </form> </body> </html>Test and see ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the target attribute.
The target attribute specifies a name or keyword that indicates where the received response is displayed after submitting the form.
The target attribute defines the name or keyword of the browser context (such as a tab, window, or inline frame).
HTML5 supports the target attribute.
In HTML 4.01 in, the target attribute is deprecated.
Note:HTML5Since HTML does not support frames and framesets, the _parent, _top, and framename values are now mainly used for iframes.
<form target="_blank|_self|_parent|_top|framename">
Value | Description |
---|---|
_blank | In a new window/Open in a tab. |
_self | Open in the same frame. (Default) |
_parent | Open in the parent frame. |
_top | Open in the entire window. |
framename | Open in the specified iframe. |