You have to manipulate the
options, not the <select> element itself. For instance, you have selectedIndex is a property of the options array. That's why you should change your function call to
onChange="updateEmployeeFields(this.options[this.[b]options.[]selectedIndex].value)"
So now you've got the value of the currently selected option. And that value is not necessarily the index of the options array! To set another select list to the option that corresponds to the select option in the firs list, try sth. like
Code:
function updateEmployeeFields(whichValue){
for(i=0;i<employeeFields.length;i++){
inner: for (var j = 0; j < document.form1.elements[employeeFields[i]].options.length; j++) {
if (document.form1.elements[employeeFields[i]].options[j].value == whichValue) {
document.form1.elements[employeeFields[i]].options[j].selected = true;
break inner;
}
}
}
}
All out of my hand and from scratch, might need a little bit polishing, but the concept should be clear (I hope)