Autofill combobox with parent selection

Hello all… I have the following code on my homepage, and it works well. I need another combobox attached to reflect return terminal. Any help would be appreciated.

<!DOCTYPE html>
<html>
  <head>
  <script>
    function byId(e) {return document.getElementById(e);}
 
    function airportComboChange()
    {
        var combo1 = byId('airportCombo');
        var combo2 = byId('termCombo');
//      alert(combo1.value);
 
        emptyCombo(combo2);
        switch(combo1.value)
        {
            case '-1':  addOption(combo2, -1, 'select airport first');
                        break;
            case '0':       addOption(combo2, 0, 'Terminal 1');
                        addOption(combo2, 1, 'Terminal 2');
addOption(combo2, 2, 'Terminal 3');
addOption(combo2, 3, 'Terminal 4');
addOption(combo2, 4, 'Terminal 5');
                        break;
            case '1':       addOption(combo2, 5, 'North');
                        addOption(combo2, 6, 'South');
                        break;
            case '2':       addOption(combo2, 7, 'Main');
                        break;
case '3':       addOption(combo2, 8, 'Main');
                        break;
case '4':       addOption(combo2, 9, 'Terminal 1');
addOption(combo2, 10, 'Terminal 2');
addOption(combo2, 11, 'Terminal 3');
                        break;
case '5':       addOption(combo2, 12, 'Main');
                        break;
case '6':       addOption(combo2, 13, 'Main');
                        break;
case '7':       addOption(combo2, 13, 'Main');
                        break;
case '8':       addOption(combo2, 14, 'Main');
                        break;
case '9':       addOption(combo2, 15, 'Main');
                        break;
case '10':       addOption(combo2, 16, 'Main');
                        break;
case '11':       addOption(combo2, 17, 'Main');
                        break;
case '12':       addOption(combo2, 18, 'Main');
                        break;
case '13':       addOption(combo2, 19, 'Main');
                        break;
case '14':       addOption(combo2, 20, 'Main');
                        break;
case '15':       addOption(combo2, 21, 'Main');
                        break;
        }
        termComboChange();
    }
 
    function termComboChange()
    {
        var combo2, tgt;
        combo2 = byId('termCombo');
        tgt = byId('tgt');
 
        tgt.innerHTML = combo2.options[combo2.options.selectedIndex].title;
    }
 
    function emptyCombo(e)
    {
        e.innerHTML = '';
    }
 
    function addOption(combo, val, txt)
    {
        var option = document.createElement('option');
        option.value = val;
        option.title = txt;
        option.appendChild(document.createTextNode(txt));
        combo.appendChild(option);
    }
 
  </script>
  </head>
  <body>
    <select id='airportCombo' onchange='airportComboChange();'>
        <option value='-1' title='-select one-'>Departure Airport</option>
        <option value='0' title='LHR'>London Heathrow - LHR</option>
        <option value='1' title='LGW'>London Gatwick - LGW</option>
        <option value='2' title='LTN'>London Luton - LTN</option>
       <option value='3' title='STN'>London Stanstead - STN</option>
<option value='4' title='MAN'>Manchester - MAN</option>
<option value='5' title='EDI'>Edinburgh - EDI</option>
<option value='6' title='BHX'>Birmingham International - BHX</option>
<option value='7' title='GLA'>Glasgow International - GLA</option>
<option value='8' title='BRS'>Bristol International - BRS</option>
<option value='9' title='LPL'>Liverpool John Lennon – LPL</option>
<option value='10' title='NCL'>Newcastle - NCL</option>
<option value='11' title='BFS'>Belfast - BFS</option>
<option value='12' title='EMA'>East Midlands - EMA</option>
<option value='13' title='ABZ'>Aberdeen Dyce - ABZ</option>
<option value='14' title='LBA'>Leeds Bradford - LBA</option>
<option value='15' title='SOU'>Southampton - SOU</option>
    </select>
 
    <select id='termCombo' onchange='termComboChange();'>
        <option value='-1' title='-select state first-'>Terminal</option>
    </select>
 </body>
</html>

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.