كائن نموذج DOM HTML
كائن النموذج
يمثل كائن النموذج عنصر HTML <form>.
الوصول إلى كائن النموذج
يمكنك الوصول إلى عنصر <form> باستخدام getElementById ():
مثال
var x = document.getElementById("myForm");
نصيحة: يمكنك أيضًا الوصول إلى عنصر <form> باستخدام مجموعة النماذج .
قم بإنشاء كائن نموذج
يمكنك إنشاء عنصر <form> باستخدام طريقة document.createElement ():
مثال
var x = document.createElement("FORM");
مجموعات كائن النموذج
Collection | Description |
---|---|
elements | Returns a collection of all elements in a form |
خصائص كائن النموذج
Property | Description |
---|---|
acceptCharset | Sets or returns the value of the accept-charset attribute in a form |
action | Sets or returns the value of the action attribute in a form |
autocomplete | Sets or returns the value of the autocomplete attribute in a form |
encoding | Alias of enctype |
enctype | Sets or returns the value of the enctype attribute in a form |
length | Returns the number of elements in a form |
method | Sets or returns the value of the method attribute in a form |
name | Sets or returns the value of the name attribute in a form |
noValidate | Sets or returns whether the form-data should be validated or not, on submission |
target | Sets or returns the value of the target attribute in a form |
طرق كائن النموذج
Method | Description |
---|---|
reset() | Resets a form |
submit() | Submits a form |
الخصائص القياسية والأحداث
يدعم كائن النموذج أيضًا الخصائص والأحداث القياسية .
الصفحات ذات الصلة
دروس HTML: نماذج HTML
برنامج JavaScript التعليمي: JS Forms / Validation
مرجع HTML: علامة HTML <form>