شكل الزر خاصية اكتب
مثال
ارجع إلى كيفية تشفير بيانات النموذج قبل إرسالها إلى الخادم:
var x = document.getElementById("myBtn").formEnctype;
التعريف والاستخدام
تقوم الخاصية formEnctype بتعيين أو إرجاع قيمة سمة formenctype لزر.
تحدد سمة formenctype كيفية تشفير بيانات النموذج قبل إرسالها إلى الخادم. تتجاوز هذه السمة سمة نوع النموذج.
تُستخدم سمة formenctype فقط للأزرار من النوع = "submit".
ملاحظة: سمة formenctype جديدة لعنصر <button> في HTML5.
دعم المتصفح
Property | |||||
---|---|---|---|---|---|
formEnctype | Yes | 10.0 | Yes | Yes | Yes |
بناء الجملة
قم بإرجاع خاصية FormEnctype:
buttonObject.formEnctype
قم بتعيين خاصية formEnctype:
buttonObject.formEnctype = "application/x-www-form-urlencoded,multipart/form-data,text/plain"
قيم الملكية
Value | Description |
---|---|
application/x-www-form-urlencoded | All characters are encoded before sent (this is default) |
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 |
تفاصيل تقنية
قيمة الإرجاع: | سلسلة ، تمثل نوع المحتوى الذي يتم استخدامه لإرسال النموذج إلى الخادم |
---|
مزيد من الأمثلة
مثال
غيّر قيمة سمة formenctype لزر من "نص / عادي" إلى "application / x-www-form-urlencoded":
document.getElementById("myBtn").formEnctype = "application/x-www-form-urlencoded";
مثال
مثال آخر على إرجاع خاصية formEnctype:
var x =
document.getElementById("myBtn").formEnctype;
الصفحات ذات الصلة
مرجع HTML: سمة تنسيق <button> HTML
❮ زر الكائن