HTML <button> formtarget Atribut
Příklad
Formulář se dvěma tlačítky pro odeslání. První tlačítko odeslat odešle data formuláře s výchozím cílem ("_self") a druhé odešle data formuláře do nového okna (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>
Definice a použití
Atribut formtarget
určuje, kde se má zobrazit odpověď po odeslání formuláře. Tento atribut přepíše atribut formuláře target
.
Atribut formtarget
se používá pouze pro tlačítka s
type="submit"
.
Podpora prohlížeče
Čísla v tabulce určují první verzi prohlížeče, která tento atribut plně podporuje.
Attribute | |||||
---|---|---|---|---|---|
formtarget | 9.0 | 10.0 | 4.0 | 5.1 | 10.6 |
Syntax
<button type="submit" formtarget="_blank|_self|_parent|_top|framename">
Hodnoty atributů
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 tag <button>