HTML <button> formtarget- Attribut
Beispiel
Ein Formular mit zwei Senden-Buttons. Die erste Senden-Schaltfläche sendet die Formulardaten mit dem Standardziel ("_self") und die zweite sendet die Formulardaten an ein neues Fenster (target="_blank"):
<form action="/action_page.php" method="get">
<label for="fname">First name:</label>
<input type="text" id="fname"
name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<button type="submit" >Submit</button>
<button type="submit" formtarget="_blank">Submit to a new window</button>
</form>
Definition und Verwendung
Das formtarget
Attribut gibt an, wo die Antwort nach dem Absenden des Formulars angezeigt werden soll. Dieses Attribut überschreibt das Attribut des Formulars target
.
Das formtarget
Attribut wird nur für Schaltflächen mit verwendet
type="submit"
.
Browser-Unterstützung
Die Zahlen in der Tabelle geben die erste Browserversion an, die das Attribut vollständig unterstützt.
Attribute | |||||
---|---|---|---|---|---|
formtarget | 9.0 | 10.0 | 4.0 | 5.1 | 10.6 |
Syntax
<button type="submit" formtarget="_blank|_self|_parent|_top|framename">
Attributwerte
Value | Description |
---|---|
_blank | Loads the response in a new window/tab |
_self | Loads the response in the same frame (this is default) |
_parent | Loads the response in the parent frame |
_top | Loads the response in the full body of the window |
framename | Loads the response in a named iframe |
❮ HTML <button>-Tag