HTML form target attribute
Examples
Submit opened in a new window or tab form, which displays the response received in a new window or tab:
<form action="demo_form.html"
method="get" target="_blank">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="submit" value="提交">
</form>
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="submit" value="提交">
</form>
try it"
Browser Support
All major browsers support the target property.
Definition and Usage
target attribute specifies a name or a keyword that indicates where to open the action URL that is displayed after the form is submitted in response to the received location.
target attribute defines the context of the browser (for example, tab, window, or inline frame) the name or keyword.
Differences between HTML 4.01 and HTML5
HTML5 support target property.
In HTML 4.01, target property has been abandoned .
Note: In HTML5, no longer support frame and frameset, so _parent, _top andframenamevalues mostly used for iframe.
grammar
<form target="_blank|_self|_parent|_top | framename ">
Property Value
值 | 描述 |
---|---|
_blank | 在新窗口/选项卡中打开。 |
_self | 在同一框架中打开。(默认) |
_parent | 在父框架中打开。 |
_top | 在整个窗口中打开。 |
framename | 在指定的 iframe 中打开。 |
HTML <form> tag