make a function processed by the onchange event of the three selects in question:
Code:
var selectIds = ["select1","select2","select3"]; // the id attribute of the three selects I want to enable/disable
function enableDisableSelect(sel) {
if (sel.value == "none") {
// enable all the selects
for (var i=0; i < selectIds.length; i++) {
document.getElementById(selectIds[i]).disabled = false;
}
} else {
// disable the other 2 selects
for (var i=0; i < selectIds.length; i++) {
if (selectIds[i] != sel.id) {
document.getElementById(selectIds[i]).disabled = true;
}
}
}
}
...
<select id="select1" onchange="enableDisableSelect(this);">...</select>
<select id="select2" onchange="enableDisableSelect(this);">...</select>
<select id="select3" onchange="enableDisableSelect(this);">...</select>
Bookmarks