In JS to take value, can use Form.xx.value, also can use Form.all.xx.value, then what difference do they have?
The original thought that plus all is to take all xx in the form (if there are more than one name of the same element), returned an array, and then searched the Internet for a moment, found that not this meaning,
All represents all the elements in the form, that is, Form.all can access any element that the <form></form> tag contains, including Div, table, and so on, while form.xx can access only the form elements, such as input, Select, and so on.
The test is as follows:
Copy Code code as follows:
<form>
<div id=div1><input Name=text1 id=text1></div>
<input name=text2 id=text2>
</form>
FORM.XX can only access Text1, Text2 (common to form elements, name, and ID), while form.all.xx has access to Text1, Text2, Div1.
Generic for form elements, name and ID, such as above, Form.text1 and Form.all.text1 equals.
Non-form elements can only be accessed through form.all.xx (xx is ID) or omit Form.all, that is, you can use XX directly.
Note: When you access a FORM element, if you have more than one XX, both form.xx and form.all.xx return an array.
For non-form elements, if you have more than one element with the same ID, form.all.xx represents the first element and ignores the other.