给段代码,你自己去研究一下吧
<script>
// 添加选项
function addOption(pos){
    var objSelect = document.myForm.mySelect;
    // 取得字段值
    var strName = document.myForm.myOptionName.value;
    var strValue = document.myForm.myOptionValue.value;
    // 建立Option对象
    var objOption = new Option(strName,strValue);
    if (pos == -1 & pos > objSelect.options.length) 
       objSelect.options[objSelect.options.length] = objOption;
    else
       objSelect.add(objOption, pos);
}
// 删除选项
function deleteOption(type){
var objSelect = document.myForm.mySelect;
if(objSelect.options.length>0){
if (type == true)
objSelect.options[objSelect.selectedIndex] = null;
else
objSelect.remove(objSelect.selectedIndex);
}
else
alert("已经没有选项可以删除了!")
}
// 显示选项信息
function showOption(objForm){
    var objSelect = objForm.mySelect;
if(objSelect.options.length>0){
document.all.myOptionName.value = objSelect.options[objSelect.selectedIndex].text;
document.all.myOptionValue.value = objSelect.options[objSelect.selectedIndex].value;
}
else
alert("没有选项可以显示!")
}
</script>
<form name="myForm">
<select name="mySelect">
<option value="value1" Selected>HTML</option>
<option value="value2">JavaScript</option>
<option value="value3">VBScript</option>
</select>
<input type="button" onclick="showOption(this.form)" value="显示">
<input type="button" onclick="deleteOption(true)" value="删除">
<input type="button" onclick="deleteOption(false)" value="Remove方法"><br><br>
选项名称 : <input type="text" name="myOptionName" value="CSS"><br>
选项的值 : <input type="text" name="myOptionValue" value="value4">
<input type="button" onclick="addOption(-1)" value="添加">
<input type="button" onclick="addOption(0)" value="插入">
</form

解决方案 »

  1.   

    function MoveItem(fromList,toList){

    if (!fromList.length){
    alert("There is no any item to be selected");
    returen;
    }
    if (fromList.selectedIndex<0){
    alert("Please Select a Item");
    return;
    }

    for (i=0;i<fromList.options.length;i++){
    if(fromList.options[i].selected){
    var addOpt=document.createElement("option")
    addOpt.text=fromList.options[i].text;
    addOpt.value=fromList.options[i].value;
    toList.add(addOpt);
    fromList.remove(i);
    }
    }


    }这个函数可以实现,只要你设置了需要移动的两个列表框,应该就OK,我是从自己的程序中Copy出来的,系统已经能够运行,不明白的可以问我
      

  2.   

    偶的可以作到n个select之间相互传递,你只要传递两个select的名字过去就行了。<table width = 520 border =1 align = center>
      <tr>
        <td width = 150 align = center>
          <Select name = Province id = Province size = 7 multiple = true ondblclick ="SelectAll(this)">
            <option value = 1>山东
            <option value = 2>江苏
            <option value = 3>安徽
            <option value = 4>河北
            <option value = 5>河南
            <option value = 6>江西
            <option value = 7>山西
            <option value = 8>陕西
            <option value = 9>宁夏
            <option value = 0>辽宁
          </Select>
        </td>
        <td width = 170 align = center>
          <img src = '../img/create.gif'  style = "cursor:hand;"  border = 0 width = 30 height = 20 onclick = Create(document.all.Province,document.all.NewProvince)>
          <img src = '../img/release.gif' style = "cursor:hand;"  border = 0 width = 30 height = 20 onclick = Create(document.all.NewProvince,document.all.Province)>
        </td>
        <td width = 150 align = center>
          <Select name = NewProvince id = NewProvince size = 7 multiple = true ondblclick ="SelectAll(this)">
       
          </Select>
        </td>
        <td width = 170 align = center>
          <img src = '../img/create.gif'  style = "cursor:hand;"  border = 0 width = 30 height = 20 onclick = Create(document.all.NewProvince,document.all.SecProvince)>
          <img src = '../img/release.gif' style = "cursor:hand;"  border = 0 width = 30 height = 20 onclick = Create(document.all.SecProvince,document.all.NewProvince)>
        </td>
        <td width = 150 align = center>
          <Select name = SecProvince id = SecProvince size = 7 multiple = true ondblclick ="SelectAll(this)">
       
          </Select>
        </td>
      </tr>
      <tr height = 80>
        <td align = center>
           <select id = Sel1>
             <option>AA
             <option>BB
             <option>CC
             <option>AA
             <option>BB
             <option>DD
           </select><br>Source          
        </td>
        <td colspan = 3 align = center>
           <input type = button value = Add onclick = "Add()">
        </td>
        <td align = center>
          <select id = Sel2>
          </select><br>Target
        </td>
      </tr>
    </table><script language = javascript>
    /*
     *多选下拉列表动态增加函数:Create(SourseObject,TargetObject);
     *参数:SourseObject:表示要动态添加的源Select;
     *参数:TargetObject:表示要动态接受的目的Select;
     *例:Create(document.all.SourSelect,document.all.TarSelect);
     *作者:月影飞鸿 于 2003-05-26晚作
    */
     function Create(SourceSelect,TargetSelect)
     {
        var IsCreate = true;
        var theIndex  = SourceSelect.selectedIndex;
        var theLength = SourceSelect.length ;
        if (theIndex == -1 ) //如果源Select为空的话,则退出过程
            return false;
        while (IsCreate)     //添加到目的Select循环
        {
            theValue = SourceSelect.options[theIndex].text;  //得到所选择的文本
          
            TargetSelect.options.add(new Option(theValue));  //目的Select增加一个文本
         
            theIndex = theIndex + 1;   //如果是选择多列的话,对下一个进行处理
            
            if (theIndex == theLength) //theLength 如果是4的话,则theIndex应该是3,
            {                          //如果两者想等的话,则源Select多了一个值,
                IsCreate = false;      //所以需要退出循环
                break;
            }
            if (SourceSelect.options[theIndex].selected == false)//如果没有被选择的话,则退出循环
            {
                IsCreate = false;
            }
        }    
        
        while (IsCreate == false)                  //删除源select循环
        {
           SecIndex  = SourceSelect.selectedIndex; //动态得到被选择的索引
           theLength = SourceSelect.length ;       //动态得到Select的长度
           SourceSelect.remove(SecIndex);          //删除指定索引的元素
           if (theLength == 1)                     //表示最后一个元素已删除,
               return false;                       //源select空了,退出循环
           if (theLength == SecIndex + 1)          //表示多选的已全部删掉,退出循环
               return false;
           if (SourceSelect.options[SecIndex].selected == false)
           {
               IsCreate = true;
           }
        }
     }
      
     function SelectAll(theSel)  //双击全部选中函数
     { 
        for (i = 0 ;i<theSel.length;i++)
        {
          theSel.options[i].selected = true;    
        }
     }
     
     function Add()
     {
       YesIt = false;
       SelectText = Sel1.options[Sel1.selectedIndex].text;
       for (i = 0 ;i < Sel2.length ; i++)
       {
         if (Sel2.options[i].text == SelectText)
         {
            alert("Target中已经存在!");
            YesIt = true;
         }
       }
       if (YesIt == false)
       {
         Sel2.options.add(new Option(SelectText));
         YesIt = true;
       }
       if (Sel2.length == 0)
       {
         Sel2.options.add(new Option(SelectText));
       }
     }
    </script>