var opt = document.createElement("OPTION");   
opt.text="select 1";
opt.value="value 1";
sel.add(opt);能看懂吧~

解决方案 »

  1.   

    对了,还有
    sel.remove(index);
    这个是删除选项的~
      

  2.   

    这个用PHP倒可以实现,你试一试WRITE。
      

  3.   

    可以支持多选;
    function MoveItem(objSource,objTarget)

      var i,j,k,n,m,sValue,sText;
      i=0;j=0;k=0;
      var temp=0;
      var TextArray = new Array();
      var ValueArray = new Array();
      for(i=0;i<objSource.length;i++)
      {
        if(objSource.options[i].selected==true)
    {
      TextArray[j] = objSource.options[i].text;
      ValueArray[j] = objSource.options[i].value;
      i--;
      objSource.options[objSource.selectedIndex] = null;
      j++;
    }
      }
      for(n=0;n<j;n++)
      {
        sText = TextArray[n]; 
        sValue = ValueArray[n];
    oOption = new Option();
        oOption.text = sText;
        oOption.value = sValue;
    for(m=0;m<objTarget.length;m++)
    {
      if(objTarget.options[m].text==sText)
      {
        temp++;
      }   
    }
    if(temp==0)
      objTarget.options[objTarget.length] = oOption;
      temp=0;
      }
    }   
    </script>
    </head><body>
    <form name="Form1">
    <select name="Listbox1" size="10" ondblclick="MoveItem(document.Form1.Listbox1,document.Form1.Listbox2)" MULTIPLE style="width:100px;">
    <option value="1">Paul</option>
    <option value="2">Mary</option>
    <option value="3">Kate</option>
    </select>
    <select name="Listbox2" size="10" style="width:100px;">
    </select>
    <input type="button" value="send" onclick="MoveItem(document.Form1.Listbox1,document.Form1.Listbox2)">
    </form>
      

  4.   

    我不同意用PHP实现,例,如果要根据月份动态添加日期,完全可以用javascript实现,要是用PHP的话,那服务器不是要累死了?