After my test,
The first way to write
<form name="form" >
<input type="text" id="tx1" value="123"><br>
</form>
<script>
alert(form.tx1.value);
</script>
The second way to write
<form id="form" >
<input type="text" id="tx1" value="123"><br>
</form>
<script>
alert(form.tx1.value);
</script>
The third way to write
<form id="form" >
<input type="text" id="tx1" value="123"><br>
</form>
<script>
alert(form.elements['tx1'].value);
</script>
The forth way to write
<form id="form" >
<input type="text" name="tx1" value="123"><br>
</form>
<script>
alert(form.elements['tx1'].value);
</script>
……..
Permutations and combinations are many, pay attention to the form’s id, name and input the id, the name, combined with the wording of the js, no matter how you write, are no problem. .
There is no standard at all. . . .
Actually, there is a standard: http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#ID-40002357
On top of the standard, most browsers implement additional features.
The safest way to refer to form elements through a named collection is:
document.formsis aHTMLCollectionof<form>elements. In each of these form, theelementsproperty is a collection of all form input elements. All elements have to be referred byname.