target (HTML attribute)
Example
Thetarget
attribute instructing the browser process the form in a
frame with a custom
name of "searchresults":
<form action="search.php" method="post" target="searchresults"> <label for="txtsearch">Search for</label> <input type="text" name="txtsearch" id="txtsearch"/> <input type="submit" name="cmdSubmit" id="cmdSubmit" value="Search"/> </form>
Description
The
target attribute is deprecated and is not used
greatly nowadays, just as web sites increasingly shun use of the frameset as layout
mechanisms. However, if you do find yourself having to maintain a
frameset-based web site, you may wish to present the results of a
form submission in a separate frame. For example, a
two-framed site that has the search form in the first
frame and the results displaying in the second
frame, such that only the results page gets refreshed
each time.
Value
"_blank"- sends results to a completely new window"frame-name"- sends results to a frame with a custom name"_parent"- sends results to the parentframesetfor the currentframe"_self"- displays the form’s submission results in the same frame (not normally required - assumed to be same window, unless specified in thebaseelement as something different in which case you would need to override using"_self", e.g.<base target="searchresults” />)"_top"- sends results to the absolute top levelframeset(in effect, the whole browser window), no matter how many nested levels down the currentframeis.
Compatibility
| IE | 5.5 | Full |
|---|---|---|
| 6.0 | Full | |
| 7.0 | Full | |
| Firefox | 1.0 | Full |
| 1.5 | Full | |
| 2.0 | Full | |
| Safari | 1.3 | Full |
| 2.0 | Full | |
| 3.0 | Full | |
| Opera | 9.2 | Full |
| 9.5 | Full |
Causes no compatibility issues. It has excellent support across all tested browsers.
User-contributed notes
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

