function loadSecondaryNetworks() {
var secondaryNetworks = new Array('13','14');
var select_list_field = document.getElementById('network');
var select_list_selected_index = select_list_field.selectedIndex;
var value = select_list_field.options[select_list_selected_index].value;
value = value.split('-');
value = value[0]+'';
for( var i=0;i<secondaryNetworks.length;i++) {
var secondSelect = document.getElementById("secondaryNetwork");
clearSelect('secondaryNetwork');
if(secondaryNetworks[i] === value) {
alert("test");
var newOption = document.createElement("option");
newOption.setAttribute("value","dep");
secondSelect.options.add(newOption);
newOption.innerHTML = "Stats for Deployed Creative";
newOption = document.createElement("option");
newOption.setAttribute("value","sub");
secondSelect.options.add(newOption);
newOption.innerHTML = "SubID Stats";
secondSelect.style.visibility = "visible";
} else {
secondSelect.style.visibility = "hidden";
}
}
}
this code is supposed to display and load a secondary drop down menu if a particular ID(13 OR 14) is selected from the first dropdown. it works fine for 14, but not for 13. the "test" alert displays for both 13 and 14, but the second drop down only appears when selecting ID 14. I changed my array to ('13','14','13') and then it worked for both 13 and 14. is there something i am not aware of?