ป้อนข้อมูล ส่งแบบฟอร์ม Enctype Property
ตัวอย่าง
ค้นหาวิธีเข้ารหัสข้อมูลแบบฟอร์มก่อนส่งไปยังเซิร์ฟเวอร์:
var x = document.getElementById("mySubmit").formEnctype;
ความหมายและการใช้งาน
คุณสมบัติ formEnctype ตั้งค่าหรือคืนค่าของแอตทริบิวต์ formenctype ของปุ่มส่ง
แอตทริบิวต์ formenctype ระบุวิธีการเข้ารหัสข้อมูลแบบฟอร์มเมื่อส่งไปยังเซิร์ฟเวอร์ (เฉพาะแบบฟอร์มที่มี method="post")
แอตทริบิวต์ formnctype แทนที่แอตทริบิวต์ enctype ขององค์ประกอบ <form>
หมายเหตุ:แอตทริบิวต์ formnctype นั้นใหม่สำหรับองค์ประกอบ <input> ที่มี type="submit" ใน HTML5
รองรับเบราว์เซอร์
Property | |||||
---|---|---|---|---|---|
formEnctype | Yes | 10.0 | Yes | Yes | Yes |
ไวยากรณ์
ส่งกลับคุณสมบัติ formEnctype:
submitObject.formEnctype
ตั้งค่าคุณสมบัติ formEnctype:
submitObject.formEnctype = "application/x-www-form-urlencoded,multipart/form-data,text/plain"
มูลค่าทรัพย์สิน
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 |
รายละเอียดทางเทคนิค
คืนมูลค่า: | สตริงที่แสดงถึงประเภทของเนื้อหาที่ใช้ในการส่งแบบฟอร์มไปยังเซิร์ฟเวอร์ |
---|
ตัวอย่างเพิ่มเติม
ตัวอย่าง
เปลี่ยนค่าของแอตทริบิวต์ formnctype ของปุ่มส่งเป็น "application/x-www-form-urlencoded":
document.getElementById("mySubmit").formEnctype = "application/x-www-form-urlencoded";
หน้าที่เกี่ยวข้อง
อ้างอิง HTML: HTML <input> formnctype แอตทริบิวต์
❮ ป้อนข้อมูลส่งวัตถุ