Form enctype attribute
Definition and usage
enctype
Sets or returns the value of the enctype attribute in the form.
The HTML enctype attribute specifies how form data should be encoded before being sent to the server.
By default, form data is encoded as "application/x-www-form-urlencoded". This means that all characters are encoded before being sent to the server (spaces are converted to "+" symbols, and special characters are converted to ASCII HEX values).
See also:
HTML reference manual:HTML <form> enctype Πρότυπο
Instance
Example 1
Return how the form data should be encoded before sending it to the server:
var x = document.getElementById("myForm").enctype;
Example 2
Change the enctype value to set how the form data should be encoded before sending it to the server:
document.getElementById("myForm").enctype = "multipart/form-data";
Syntax
Return enctype attribute:
formObject.enctype
Set enctype attribute:
formObject.enctype = "application/x-www-form-urlencoded,multipart/form-data,text/plain"
Attribute value
Value | Description |
---|---|
application/x-www-form-urlencoded | All characters are encoded before transmission (default). |
multipart/form-data | Δεν κωδικοποιούνται χαρακτήρες. Όταν χρησιμοποιείτε φόρμα με στοιχεία ανέβασμα αρχείων, αυτή η τιμή είναι απαραίτητη. |
text/plain | Ο μετασχηματισμός του κενό σε "+" σύμβολο, αλλά δεν κωδικοποιείται τα ειδικά χαρακτήρες. |
Τεχνικά Στοιχεία
Αποτελεσματικότητα: | Αξία 문자열, που δείχνει πώς θα κωδικοποιηθούν τα δεδομένα του φόρματος πριν από την αποστολή τους στο διακομιστή. |
---|
Υποστήριξη Βrowser
Τα αριθμήματα στη τάβλη περιλαμβάνουν την έκδοση του προγράμματος περιήγησης που υποστηρίζει πλήρως το χαρακτηριστικό.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Υποστήριξη | Υποστήριξη | Υποστήριξη | Υποστήριξη | Υποστήριξη |