HTML <input> formattarget Atrybut
Przykład
Formularz z dwoma przyciskami przesyłania, z różnymi oknami docelowymi:
<form action="/action_page.php">
<input type="text" id="fname" name="fname"><br><br>
<label
for="lname">Last name:</label>
<input type="text" id="lname"
name="lname"><br><br>
<input type="submit" value="Submit as normal">
<input type="submit" formtarget="_blank" value="Submit to a new window">
</form>
Definicja i użycie
Atrybut określa nazwę lub słowo formtarget
kluczowe, które wskazuje, gdzie wyświetlić odpowiedź otrzymaną po przesłaniu formularza.
formtarget
Atrybut zastępuje target
atrybut <form>
elementu .
Uwaga: Atrybutu formtarget
można używać z
type="submit"
i
type="image"
.
Obsługa przeglądarki
Liczby w tabeli określają pierwszą wersję przeglądarki, która w pełni obsługuje ten atrybut.
Attribute | |||||
---|---|---|---|---|---|
formtarget | Yes | 10.0 | Yes | 5.1 | 10.6 |
Składnia
<input formtarget="_blank|_self|_parent|_top|framename">
Wartości atrybutów
Value | Description |
---|---|
_blank | The response is displayed in a new window or tab |
_self | The response is displayed in the same frame (this is default) |
_parent | The response is displayed in the parent frame |
_top | The response is displayed in the full body of the window |
framename | The response is displayed in a named iframe |
❮ Znacznik HTML <input>