I was looking at some sample code tutorials and noticed that on Javascript-coder.com, the author has several entries about form access which use two different methods of accessing form elements without explanation.
Example:
var myForm = document.forms["myForm"];
var elem = myForm[anInputName];
//OR
var myForm = document.forms["myForm"];
var elem = myForm.elements[anInputName];
Both appear to provide valid access to the element. Google just seems to crap out a bunch of syntax references. Why do both work?