Select List Dynamically Created

[Total: 0    Average: 0/5]

Choose from a dynamic select list.

Head Code:

<SCRIPT language=JavaScript> 
var theaterNameArray = new Array(); 
var theaterValueArray = new Array(); 
theaterNameArray[1] = new Array('Century 16, Anchorage'); 
theaterValueArray[1] = new Array('53'); 
theaterNameArray[2] = new Array('Glendale Drive-In, Glendale','Scottsdale Drive-In, Scottsdale','Century 20 El Con Mall, Tucson','Century Gateway 12, Tucson','Century Park 16, Tucson'); 
theaterValueArray[2] = new Array('4','3','57','1','2'); 
theaterNameArray[3] = new Array('Hyatt Cinema 3, Burlingame','Solano Drive-Ins 2, Concord','Century Laguna 16, Elk Grove','Century Folsom, Folsom','Cinedome Fremont 8, Fremont','Century Larkspur, Larkspur','Century 20 Great Mall, Milpitas','Century Cinema 16, Mountain View','Cinedome Napa 8, Napa','Cinedome Newark 7, Newark','Century Pinole 10, Pinole','Century Pleasant Hill, Pleasant Hill','Century Park 12, Redwood City','Century Roseville 14, Roseville','Century Stadium 14, Sacramento','Cinedome, Sacramento','Downtown Plaza 7, Sacramento','Sacramento Drive-In, Sacramento','Century Park 7, Salinas','Northridge, Salinas','Century Plaza 10, San Francisco','Cinema 21, San Francisco','Empire Cinema, San Francisco','Presidio 1, San Francisco','Capitol Drive-In, San Jose','Century 21, San Jose','Century 22, San Jose','Century 23, San Jose','Century 24, San Jose','Century 25, San Jose','Century Berryessa, San Jose','Century Capitol 16, San Jose','Century 25, Union City','Cinedome Vallejo 8, Vallejo'); 
theaterValueArray[3] = new Array('35','21','17','19','27','45','65','36','16','29','20','18','40','46','13','15','60','12','23','22','37','31','39','32','24','33','30','28','26','25','34','38','55','14'); 
theaterNameArray[4] = new Array('Century N. Hollywood, North Hollywood','Stadium Promenade 25, Orange','Century Downtown 10, Ventura','Century Ventura 16, Ventura'); 
theaterValueArray[4] = new Array('10','43','51','11'); 
theaterNameArray[5] = new Array('Century 16, Aurora'); 
theaterValueArray[5] = new Array('54'); 
theaterNameArray[6] = new Array('Century 12, Evanston','CineArts 6, Evanston'); 
theaterValueArray[6] = new Array('62','63'); 
theaterNameArray[7] = new Array('Cinedome, Henderson','Century 18 Sam's Town, Las Vegas','Century Orleans 12, Las Vegas','Century Suncoast 16, Las Vegas','Cinedome, Las Vegas','Las Vegas Drive-In, Las Vegas','Rancho Santa Fe, Las Vegas','Century 16 Park Lane, Reno','Riverside 12, Reno','El Rancho Drive-In 4, Sparks','Sparks 14, Sparks'); 
theaterValueArray[7] = new Array('7','64','42','61','8','5','6','48','59','9','44'); 
theaterNameArray[8] = new Array('Century 24, Albuquerque'); 
theaterValueArray[8] = new Array('41'); 
theaterNameArray[9] = new Array('Century Eastport 16, Portland'); 
theaterValueArray[9] = new Array('52'); 
theaterNameArray[10] = new Array('Stadium 14, Sioux Falls'); 
theaterValueArray[10] = new Array('58'); 
theaterNameArray[11] = new Array('Century Abilene 12, Abilene','Century 16, Corpus Christi','Century Odessa 12, Odessa'); 
theaterValueArray[11] = new Array('49','56','47'); 
theaterNameArray[12] = new Array('Century Salt Lake, Salt Lake City'); 
theaterValueArray[12] = new Array('50'); 

function changeTheaterOptions(){ 
  // Obtain the first dimension position of the currently selected theaterRegion 
  // 
  var regionIX = document.forms["search"].regionSelect.selectedIndex; 
  
  if (regionIX > 0){ 
    // set the length of the new multi-option 
    // 
    document.forms["search"].elements["theaterSelect"].options.length = theaterNameArray[regionIX].length +1; 
    
    document.forms["search"].elements["theaterSelect"].options[0].text = ";-) Select a Theater"; 
    document.forms["search"].elements["theaterSelect"].options[0].value = ""; 
    for (var j=0; j < theaterNameArray[regionIX].length; j++)
    { 
      document.forms["search"].elements["theaterSelect"].options[j+1].text = theaterNameArray[regionIX][j]; 
      document.forms["search"].elements["theaterSelect"].options[j+1].value = theaterValueArray[regionIX][j] + "-" + theaterNameArray[regionIX][j]; 
    } 
  }
  else
  { 
    // User has reselected the blank 'region' option 
    // 
    document.forms["search"].elements["theaterSelect"].options.length = 2; 
    document.forms["search"].elements["theaterSelect"].options[0].text = "Select a Theater"; 
    document.forms["search"].elements["theaterSelect"].options[0].value = ""; 
    document.forms["search"].elements["theaterSelect"].options[1].text = "Select a State First"; 
    document.forms["search"].elements["theaterSelect"].options[1].value = ""; 
  } 
} 
</SCRIPT>

Body Code:

<FORM name=search action=search/index.html method=post>
<INPUT type=hidden value=Hide name=endTime>  
<P>1) Search for:<BR>
  <SELECT name=movieSelect>  
  <OPTION value="" selected>Select a Movie</OPTION>  
  <OPTION value="24870-102 Dalmatians">102 Dalmatians</OPTION>  
  <OPTION value="25516-All the Pretty Horses">All Pretty Horses</OPTION>  
  <OPTION value="26572-Antitrust">Antitrust</OPTION>
  </SELECT>
<BR> 
<P>2) and/or<BR>
  <SELECT onchange=changeTheaterOptions() name=regionSelect>  
  <OPTION value="" selected>Select a State</OPTION>  
  <OPTION value="1-Alaska">Alaska</OPTION>
  <OPTION value="2-Arizona">Arizona</OPTION>  
  <OPTION value="3-California Northern">California Northern</OPTION>
  </SELECT>  
<BR> 
<BR> 
<P>3) and/or<BR> 
<SELECT name=theaterSelect>  
  <OPTION value="" selected>Select a Theater</OPTION>  
  <OPTION value="">Select a State First</OPTION>
</SELECT>  
<BR></FORM>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *