Take the value in JS, you can use form.xx.Value, or form.all.xx.value, so what is the difference between them?
Originally, I thought it took it for granted that the ALL was to take all the XX in Form (if there were multiple elements of multiple names), and returned an array. Later, I searched it on the Internet and found that this is not the meaning.
ALL represents all elements in Form, that is, form.all can access any elements contained in the <FORM> </Form> tags, including div, table, etc., and Form.xx can only access the unit unit elements, such as input, selection wait.
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 (for table unit elements, common to ID), and form.all.xx can access Text1, Text2, DIV1.
For table unit elements, Name and ID -purpose, such as above, form.text1 and form.all.text1 are the same.
For non -table unit elements, you can only access through form.all.xx (xx (xx are ID), or you can omit the form.all, that is, you can use XX directly.
Note: When accessing the form of the table, if there are multiple XX, the form.xx and form.all.xx return are arrays
For non -table elements, if there are multiple IDs with the same ID, form.all.xx represents the first element and will ignore others.