Now that you know how the DOM works, I'm going to twist your arm a little bit. You don't have to refer to each element using it's name. Every element on the page is also stored as an array - such as an array of all of the images, an array of the forms, and within each form, an array of the different input types.
As far as I know, window.document will always be there. There may be an array of all of the open windows, but I don't want to jump to conclusions and I don't want to test so I'm just going to leave it up in the air - there may or may not be an array of all of the open windows. So you have window.document, and then the fun begins...
Lets say you have 30 images on a page and you forgot to name them. That would be an annoyingly large amount of work, so you can just refer to the image by it's position in the array, which is determined by where it occurs on the page. The first image is 0, the fifth is 4, etc. It is simply done by window.document.images[image's_index]. That's it. You can even make a for loop to look at and modify each image on the page!
The same goes for forms. Have 18 forms on one page (for some reason...) and none of them are named? Simply refer to it by it's position on the page. If it's the first form, it's index is 0. The third form is 2, etc.
The elements of individual forms are stored differently though. They are stored in what's known as an associative array. It uses names instead of indexing to store information. So if you want to get the first text box that occurs in the third form on the page, just do this: window.document.forms[2].elements['Text']. This works just like normal. Here's a list of all of the different elements:Button, Checkbox, Hidden, Password, Radio, Reset, Select, Submit, Text, Textarea. You'll learn what you can do with all of those guys in the next lesson. Just to clarify, just put the element inside of the elements[] brackets, and in quotes. It must be capitalized, too. So: window.document.form[0].elements['Checkbox'], window.document.form[2].elements['Textarea']. Easy, eh? Well then, lets do the next lesson...