The following code can be used to dynamically add, remove or select all items in a SELECT object. The code assumes that when objects are added to the SELECT object, that the display text and value are identical.
<script language="javascript"> function addToList(txtBox, selectBox){ var oOption = document.createElement("OPTION"); oOption.text = txtBox.value; oOption.value = txtBox.value; selectBox.add(oOption); txtBox.value = ""; txtBox.focus(); } function removeFromList(selectBox){ selectBox.remove(selectBox.selectedIndex); } function selectEntireList(selectBox){ var fromObj = selectBox; for ( selIndex = fromObj.length; selIndex -- ; selIndex > 0 ){ if(fromObj.options[selIndex].text != ""){ fromObj.options[selIndex].selected = true; } } } </script>