Input Submit formEnctype Attribute
Definition and Usage
formEnctype
Sets or returns the value of the formenctype attribute of the submit button.
The HTML formenctype attribute specifies how form data should be encoded when submitted to the server (only for forms with method="post").
The formenctype attribute overrides the <form> element's enctype attribute.
Note:The formenctype attribute is a new attribute of the <input> element with type="submit" in HTML5.
See Also:
HTML Reference Manual:HTML <input> formenctype ιδιότητα
Instance
Example 1
Find out how to encode form data before submitting it to the server:
var x = document.getElementById("mySubmit").formEnctype;
Example 2
Change the formenctype attribute value of the submit button to "application/x-www-form-urlencoded":
document.getElementById("mySubmit").formEnctype = "application/x-www-form-urlencoded";
Syntax
Return the formEnctype attribute:
submitObject.formEnctype
Set the formEnctype attribute:
submitObject.formEnctype = "application/x-www-form-urlencoded,multipart/form-data,text/plain"
Attribute Value
Value | Description |
---|---|
application/x-www-form-urlencoded | Default. All characters are encoded before sending (spaces are converted to "+" symbols, special characters are converted to ASCII HEX values). |
multipart/form-data | Do not encode characters. This value is required when you use a form with a file upload control. |
text/plain | Τα κενά μετατρέπονται σε σύμβολο "+", αλλά δεν κωδικοποιούνται τα ειδικά χαρακτήρες. |
Τεχνικά λεπτομέρειες
Αποτελεσματικότητα: | Τυπική τιμή字符串, που δείχνει τον τύπο περιεχομένου που θα υποβληθεί στο διακομιστή. |
---|
Υποστήριξη περιηγητή
Τα αριθμήματα στη τάβλη δείχνουν την έκδοση του περιηγητή που υποστηρίζει πλήρως αυτή την ιδιότητα.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Υποστήριξη | 10.0 | Υποστήριξη | Υποστήριξη | Υποστήριξη |