Pulsante formEnctype Proprietà
Esempio
Restituisce come codificare i dati del modulo prima di inviarli a un server:
var x = document.getElementById("myBtn").formEnctype;
Definizione e utilizzo
La proprietà formEnctype imposta o restituisce il valore dell'attributo formenctype di un pulsante.
L'attributo formenctype specifica come codificare i dati del modulo prima di inviarli a un server. Questo attributo sovrascrive l'attributo enctype del modulo.
L'attributo formenctype viene utilizzato solo per i pulsanti con type="submit".
Nota: l'attributo formenctype è nuovo per l'elemento <button> in HTML5.
Supporto browser
Property | |||||
---|---|---|---|---|---|
formEnctype | Yes | 10.0 | Yes | Yes | Yes |
Sintassi
Restituisce la proprietà formEnctype:
buttonObject.formEnctype
Imposta la proprietà formEnctype:
buttonObject.formEnctype = "application/x-www-form-urlencoded,multipart/form-data,text/plain"
Valori di proprietà
Value | Description |
---|---|
application/x-www-form-urlencoded | All characters are encoded before sent (this is default) |
multipart/form-data | No characters are encoded. This value is required when you are using forms that have a file upload control |
text/plain | Spaces are converted to "+" symbols, but no special characters are encoded |
Dettagli tecnici
Valore di ritorno: | Una stringa, che rappresenta il tipo di contenuto utilizzato per inviare il modulo al server |
---|
Altri esempi
Esempio
Modifica il valore dell'attributo formenctype di un pulsante da "text/plain" a "application/x-www-form-urlencoded":
document.getElementById("myBtn").formEnctype = "application/x-www-form-urlencoded";
Esempio
Un altro esempio sulla restituzione della proprietà formEnctype:
var x =
document.getElementById("myBtn").formEnctype;
Pagine correlate
Riferimento HTML: attributo HTML <pulsante> formenctype
❮ Oggetto pulsante