Input Submit formEnctype Attribute
Definition and Usage
formEnctype
Attribute 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 a 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 HTML5 <input> element with type="submit".
See Also:
HTML Reference Manual:Atribut formenctype <input> HTML
Instance
Example 1
Pertahankan bagaimana hendak dienkodikan data bentuk sebelum dihantar ke pelayan:
var x = document.getElementById("mySubmit").formEnctype;
Example 2
Tukar nilai attribute formenctype tukar butang sumbangan kepada "application/x-www-form-urlencoded":
document.getElementById("mySubmit").formEnctype = "application/x-www-form-urlencoded";
Syntax
Return formEnctype attribute:
submitObject.formEnctype
Set formEnctype attribute:
submitObject.formEnctype = "application/x-www-form-urlencoded,multipart/form-data,text/plain"
Attribute Value
Value | Description |
---|---|
application/x-www-form-urlencoded | Default. Semua aksara akan disiarkan sebelum dihantar (spasi diubah kepada simbol "+", aksara khas diubah kepada nilai HEX ASCII). |
multipart/form-data | Buatkan pengodean aksara. Ini adalah wajib ketika anda menggunakan bentuk yang mempunyai widget pengunggah fail. |
text/plain | Ruang diubah kepada simbol "+", tetapi ikon khas tidak disifatkan. |
Perincian teknikal
Hasil balik: | Nilai string, menunjukkan jenis kandungan yang digunakan untuk menghantar borang ke pelayar. |
---|
Dukungan pelayar
Angka di dalam tabel menunjukkan versi paling awal yang mendukung sifat ini.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Dukungan | 10.0 | Dukungan | Dukungan | Dukungan |