Language Basics JavaScript DHTML

/*
JavaScript Bible, Fourth Edition
by Danny Goodman 
John Wiley & Sons CopyRight 2001
*/


Parallel Array Lookup

// the data
var regionalOffices = new Array("New York", "Chicago", "Houston", "Portland") 
var regionalManagers = new Array("Shirley Smith", "Todd Gaston", "Leslie Jones", "Harold Zoot") 
var regOfficeQuotas = new Array(300000, 250000, 350000, 225000) 
// do the lookup into parallel arrays
function getData(form) { 
   var i = form.offices.selectedIndex 
   form.manager.value = regionalManagers[i] 
   form.quota.value = regOfficeQuotas[i] 




Parallel Array Lookup




 

 
Select a regional office: 
 
   

 
The manager is: 
 

 
The office quota is: