-
The form object allows your script to interact with HTML forms.
-
The form object is accessed as a property of the document object.
-
Form[] array can be used when more than one form in the same HTML.
-
Any one of these statements will access form1.
-
document.myform1 or
-
document.forms[0]
Syntax:
window.document.form_name or document.form_name
- Every form can contain one or more of the elements such as radio button, push button, checkbox, submit button, reset button, options menu and text area.
-
The elements on the form can be accessed by:
window.document.form_name.element_name
-
The elements array is a property of the form object.
-
It contains the list of all elements contained in a form.
document.myform1.elements[3].value
The number of elements in the elements array can be determined using the length property
document.myform1.elements.length


Recent Comments