The above code would refer to an image named "myphoto" residing in a document loaded into a web browser window.
An instance is one particular incarnation of an object. For example, a car is an object and a Plymouth Sundance is one instance of the car object. The photograph above is an instance of the image object.
In real life objects may also have properties. A car object may have a property known as "color". That property would be referred to as:
The image below of my head is created using a standard HTML tag called IMG. One of the attributes of the tag is the NAME attribute. In this example the NAME attribute has a value of "estrella". Here is the HTML code.
Move the mouse over the image below to see the relevant code.
In real life, we deal with variables all the time. At a bar, several patrons may order "the usual". The bartender, being familiar with each patron, assigns the value "gin and tonic" to the variable "the usual" for one patron and assigns the value "margarita" to the variable "the usual" for another patron. Similarly, a variable named "myFavoriteColor" may be assigned different values. The code below illustrates the creation and use of a variable to assign the color "teal" to the car object.
Valid named colors for web pages are white, black, green, maroon, olive, navy, purple, gray, red, yellow, blue, teal, lime, aqua, fuchsia, and silver.
An array is an ordered collection of data. Each element of an array is a variable which can hold data of any type. Generally an array is used to hold related data. A particularly intuitive example is an array to represent the spices in a spice rack in your kitchen.
Var spicerack = new Array();
The numbering of arrays always begins at 0 but programmers sometimes do not populate the  element so that numbering can begin more naturally at 1. The value of any element in the array can be changed through simple assignment.
spicerack = "garlic";
Very often in programming a 'for' loop is used to populate an array with values. For example, the form below requests information about a user's favorite spices. The information is stored in an array using a simple 'for' loop.
Event handlers may also respond to an event by changing the value of a property. In this case the shape property of the tire object is assigned the value of "flat".
A value can be assigned to a variable using a simple assignment operator like the equal sign ("=").
More complex operators may be used to alter the value once it is assigned.
For text values the addition operator concatenates (joins) text strings together.
alert("What do you want me to do, " + document.sampleform.username.value + "?");}
Here is a simple example. The form below asks the user to type in a name. When the button is clicked, the 'doSomething' function is called and an alert box containing the user's name is displayed.
window.document.sampleform.username.value = "Some text goes here";
In practice the reference to the current window can be assumed so designers more often will simply type:
document.sampleform.username.value = "Some text goes
One of the principal differences between the DOMs of Netscape and Microsoft is the use of the ALL keyword in Microsoft's Internet Explorer. Any uniquely named object can be referenced in Internet Explorer DOM using the following structure:
This works for SPAN and DIV tags or any other object with a unique ID attribute. The use of the ALL keyword means that creating references to deeply nested objects in Internet Explorer is simpler than in Netscape Communicator.
It is necessary to understand many details of the two DOM implementations to script changes to object position and visibility that take place after the page has loaded. For a very complete reference, see Danny Goodman's book Dynamic HTML: The Definitive Reference, published by O'Reilly in 1998.