Un esempio....
codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript">
<!--
function populate(aSelect) {
newOption = document.createElement('OPTION');
aSelect.add(newOption);
newOption.value = "A";
newOption.text = "A";
newOption = document.createElement('OPTION');
aSelect.add(newOption);
newOption.value = "B";
newOption.text = "B";
newOption = document.createElement('OPTION');
aSelect.add(newOption);
newOption.value = "C";
newOption.text = "C";
newOption = document.createElement('OPTION');
aSelect.add(newOption);
newOption.value = "D";
newOption.text = "D";
newOption = document.createElement('OPTION');
aSelect.add(newOption);
newOption.value = "E";
newOption.text = "E";
} // function populate(aSelect)
function svuota(aSelect) {
//---------- Prima svuoto tutti valori tranne quello selezionato nella select selezionata
value = aSelect.value;
numElement = aSelect.length;
var i = 0;
for (j=numElement-1;j>=0;j--) {
curOption = aSelect.options(j);
if (curOption.value != value) {
aSelect.remove(j);
} // if (curOption.value != value)
} // for (j=numElement-1;j>=0;j--)
//---------- adesso per ogni select del div (parent) rimuovo il valore scelto
svuota2(aSelect,'sel1');
svuota2(aSelect,'sel2');
svuota2(aSelect,'sel3');
svuota2(aSelect,'sel4');
svuota2(aSelect,'sel5');
} // function svuota(unValore)
function svuota2(aSelect,selectDaSvuotare) {
if (aSelect.id == selectDaSvuotare) {
return;
} // if (aSelect.id == selectDaSvuotare)
var objSelectDaSvuotare = document.getElementById(selectDaSvuotare);
numElement = objSelectDaSvuotare.length;
for (j=numElement-1;j>=0;j--) {
curOption = objSelectDaSvuotare.options(j);
if (curOption.value == aSelect.value) {
objSelectDaSvuotare.remove(j);
} // if (curOption.value == aSelect.value)
} // for (j=numElement-1;j>=0;j--)
} // function svuota2(aSelect,selectDaSvuotare)
function ripopolaTutto() {
ripopola('sel1');
ripopola('sel2');
ripopola('sel3');
ripopola('sel4');
ripopola('sel5');
} // function ripopolaTutto()
function ripopola(selectDaRipopolare) {
var aSelect = document.getElementById(selectDaRipopolare);
aSelect.innerHTML = '';
populate(aSelect)
} // function ripopola(selectDaRipopolare)
//-->
</script>
</head>
<body>
<div id="group1">
<select id="sel1" onchange="svuota(this)"></select>
<select id="sel2" onchange="svuota(this)"></select>
<select id="sel3" onchange="svuota(this)"></select>
<select id="sel4" onchange="svuota(this)"></select>
<select id="sel5" onchange="svuota(this)"></select>
</div>
<input type="button" value="Ripopola" onclick="ripopolaTutto()">
<script language="JavaScript" type="text/javascript">
<!--
populate(document.getElementById('sel1'));
populate(document.getElementById('sel2'));
populate(document.getElementById('sel3'));
populate(document.getElementById('sel4'));
populate(document.getElementById('sel5'));
//-->
</script>
</body>
</html>