function moveList(srcList,destList) {
var src_len=srcList.length;
var len = destList.length;
for(var i = 0; i < src_len; i++) {
if ((srcList.options[i] != null) && (srcList.options[i].selected)) {
var found = false;
for(var count = 0; count < len; count++) {
if (destList.options[count] != null) {
if (srcList.options[i].value == destList.options[count].value) {
found = true;
break;
}
}
}
if (found != true) {
destList.options[len]= new Option(srcList.options[i].text,srcList.options[i].value);
len++;
}
}
}
deleteSelectList(srcList);
}function deleteSelectList(destList) {
var len = destList.options.length;
for(var i = (len-1); i >= 0; i--) {
if ((destList.options[i]!= null) && (destList.options[i].selected == true)) {
destList.options[i]= null;
}
}
}function deleteAllList(destList) {
var len = destList.options.length;
for(var i = (len-1); i >= 0; i--)destList.options[i]= null;
}
var src_len=srcList.length;
var len = destList.length;
for(var i = 0; i < src_len; i++) {
if ((srcList.options[i] != null) && (srcList.options[i].selected)) {
var found = false;
for(var count = 0; count < len; count++) {
if (destList.options[count] != null) {
if (srcList.options[i].value == destList.options[count].value) {
found = true;
break;
}
}
}
if (found != true) {
destList.options[len]= new Option(srcList.options[i].text,srcList.options[i].value);
len++;
}
}
}
deleteSelectList(srcList);
}function deleteSelectList(destList) {
var len = destList.options.length;
for(var i = (len-1); i >= 0; i--) {
if ((destList.options[i]!= null) && (destList.options[i].selected == true)) {
destList.options[i]= null;
}
}
}function deleteAllList(destList) {
var len = destList.options.length;
for(var i = (len-1); i >= 0; i--)destList.options[i]= null;
}
<!-- TWO STEPS TO INSTALL MENU SWAPPER: 1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document --><!-- STEP ONE: Paste this code into the HEAD of your HTML document --><HEAD><SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function move(fbox, tbox) {
var arrFbox = new Array();
var arrTbox = new Array();
var arrLookup = new Array();
var i;
for (i = 0; i < tbox.options.length; i++) {
arrLookup[tbox.options[i].text] = tbox.options[i].value;
arrTbox[i] = tbox.options[i].text;
}
var fLength = 0;
var tLength = arrTbox.length;
for(i = 0; i < fbox.options.length; i++) {
arrLookup[fbox.options[i].text] = fbox.options[i].value;
if (fbox.options[i].selected && fbox.options[i].value != "") {
arrTbox[tLength] = fbox.options[i].text;
tLength++;
}
else {
arrFbox[fLength] = fbox.options[i].text;
fLength++;
}
}
arrFbox.sort();
arrTbox.sort();
fbox.length = 0;
tbox.length = 0;
var c;
for(c = 0; c < arrFbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrFbox[c]];
no.text = arrFbox[c];
fbox[c] = no;
}
for(c = 0; c < arrTbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrTbox[c]];
no.text = arrTbox[c];
tbox[c] = no;
}
}
// End -->
</script></HEAD><!-- STEP TWO: Copy this code into the BODY of your HTML document --><BODY><form name="combo_box">
<table><tr><td>
<select multiple size="10" name="list1" style="width:150">
<option value="12">Alabama</option>
<option value="54">Alaska</option>
<option value="65">Arizona</option>
<option value="45">Arkansas</option>
<option value="2">California</option>
<option value="6">Colorado</option>
<option value="81">Connecticut</option>
<option value="5">Delaware</option>
<option value="23">District of Columbia</option>
<option value="58">Florida</option>
<option value="87">Georgia</option>
<option value="98">Hawaii</option>
<option value="53">Idaho</option>
<option value="22">Illinois</option>
<option value="28">Indiana</option>
<option value="89">Iowa</option>
<option value="71">Kansas</option>
<option value="35">Kentucky</option>
<option value="85">Louisiana</option>
<option value="9">Maine</option>
<option value="7">Maryland</option>
<option value="77">Massachusetts</option>
<option value="36">Michigan</option>
<option value="87">Minnesota</option>
<option value="66">Mississippi</option>
<option value="34">Missouri</option>
<option value="50">Montana</option>
<option value="20">Nebraska</option>
<option value="25">Nevada</option>
<option value="32">New Hampshire</option>
<option value="27">New Jersey</option>
<option value="74">New Mexico</option>
<option value="17">New York</option>
<option value="3">North Carolina</option>
<option value="13">North Dakota</option>
<option value="4">Ohio</option>
<option value="21">Oklahoma</option>
<option value="12">Oregon</option>
<option value="48">Pennsylvania</option>
<option value="63">Rhode Island</option>
<option value="82">South Carolina</option>
<option value="14">South Dakota</option>
<option value="72">Tennessee</option>
<option value="49">Texas</option>
<option value="47">Utah</option>
<option value="92">Vermont</option>
<option value="59">Virginia</option>
<option value="52">Washington</option>
<option value="41">West Virginia</option>
<option value="46">Wisconsin</option>
<option value="95">Wyoming</option>
</select>
</td>
<td align="center" valign="middle">
<input type="button" onClick="move(this.form.list2,this.form.list1)" value="<<">
<input type="button" onClick="move(this.form.list1,this.form.list2)" value=">>">
</td>
<td>
<select multiple size="10" name="list2" style="width:150">
</select>
</td></tr></table>
</form>