I have three DropDownList, all have values of 1,2 and 3...

DropDownList1 has a selected value of 1

DropDownList2 has a selected value of 3

DropDownList3 has a selected value of 2


What I want is to swap values.

i.e. if I selected number 2 in DropDownList1, DropDownList3 should select 1 automatically.

n the Javascript I check if the selected value from first drop down matches the element from second drop down..but I can't put a logic to swap values

<tr><td>
<select name='order1' onchange='UpdateColumnOrder(this)' >
<option value=1 >1</option>
<option value=2 >2</option>
<option value=3 >3</option>
</select>
</tr></td>
<!-- second drop downdown box -->
<tr><td>
<select name='order2' onchange='UpdateColumnOrder(this)' >
<option value=1 >1</option>
<option value=2 selected >2</option>
<option value=3 >3</option>
</select>
</tr></td>



function UpdateColumnOrder(elt){
//check for duplicate selections
var form=elt.form;
var name=elt.name;
var index=elt.selectedIndex
//loop through all form elements
for(var i=0;i<form.length;i++){
var_name=form.elements[i].name;
var_index=form.elements[i].selectedIndex;

// if form element is not the current element
// and the division name is the same, raise
//error message
if(var_name!=name&&index!=0&&var_index==index){
elt.selectedIndex=0;
elt.focus();
return false;
}
}
return true;
}