Records are accessed using the syntax arrayname[Element number].property
record = new field(); // Create a second object to the array.Associative array example
The code for this example is listed below
//declare 'record' as a global array variable.
var record = new Array();
record = new field("Peter","Centreville","VA");// function call to object constructor.
alert("The first name is " + record.name +" and the listed city is " +record.city);
record.name = "Peter Lorre"; // Update name from 'Peter' to 'Peter Lorre'
alert("The name field of the First element has been changed to " + record.name);
record = new field(); // Create a second object to the array.
record.name = "Charles"; //Assign values to array object.
record.city = "Springfield";
record.state = "NC";
record.address = "1313 Elm Street";// create field that is not part of the original object.
record = new field("Alan","Allentown","PA"); // Add new record to array.
alert("address: " + record.address);
alert( record.city + " state: " + record.state);
//object constructor. Order of arguments passed to the function must be the same as the function calls arguments.
this.city = city;
this.state = state;