Input Kirim formEnctype Property
Contoh
Cari tahu bagaimana data formulir harus dikodekan sebelum mengirimkannya ke server:
var x = document.getElementById("mySubmit").formEnctype;
Definisi dan Penggunaan
Properti formEnctype menyetel atau mengembalikan nilai atribut formenctype dari tombol kirim.
Atribut formenctype menentukan bagaimana data formulir harus dikodekan saat mengirimkannya ke server (hanya untuk formulir dengan metode = "posting").
Atribut formenctype menimpa atribut enctype dari elemen <form>.
Catatan: Atribut formenctype baru untuk elemen <input> dengan type="submit" di HTML5.
Dukungan Peramban
Property | |||||
---|---|---|---|---|---|
formEnctype | Yes | 10.0 | Yes | Yes | Yes |
Sintaksis
Kembalikan properti formEnctype:
submitObject.formEnctype
Setel properti formEnctype:
submitObject.formEnctype = "application/x-www-form-urlencoded,multipart/form-data,text/plain"
Nilai properti
Value | Description |
---|---|
application/x-www-form-urlencoded | Default. All characters are encoded before sent (spaces are converted to "+" symbols, and special characters are converted to ASCII HEX values) |
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 |
Detail Teknis
Nilai Kembali: | Sebuah String, mewakili jenis konten yang digunakan untuk mengirimkan formulir ke server |
---|
Lebih Banyak Contoh
Contoh
Ubah nilai atribut formenctype dari tombol kirim menjadi "application/x-www-form-urlencoded":
document.getElementById("mySubmit").formEnctype = "application/x-www-form-urlencoded";
Halaman Terkait
Referensi HTML: HTML <input> atribut formenctype
Masukkan Objek Kirim