Attributo HTML <input> formtarget

❮ Tag HTML <input>

Esempio

Un modulo con due pulsanti di invio, con diverse finestre di destinazione:

<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>

Definizione e utilizzo

L' formtargetattributo specifica un nome o una parola chiave che indica dove visualizzare la risposta ricevuta dopo l'invio del modulo.

L' formtargetattributo sovrascrive l' target attributo <form>dell'elemento.

Nota: l' formtargetattributo può essere utilizzato con type="submit"e type="image".


Supporto del browser

I numeri nella tabella specificano la prima versione del browser che supporta completamente l'attributo.

Attribute
formtarget Yes 10.0 Yes 5.1 10.6

Sintassi

<input formtarget="_blank|_self|_parent|_top|framename">

Valori di attributo

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

❮ Tag HTML <input>