function add_singer(object,value,text)//添加数据
{
object.options.add(new Option(text,value,true,true));
}function remove_singer(object,index)//删除数据
{
object.options.remove(index)
}

解决方案 »

  1.   

    <script language="javascript" >
    var manarray= new Array();
    function add(show)   //show is document.form1
    {
    for (i=0;i<show.chooseman.options.length;i++)
    {
    if (show.chooseman.options[i].selected==true)
    {
    var value=show.chooseman.options[i].value;
    var text=show.chooseman.options[i].text
    manarray.push(value);
    show.all.docreciever.options.add(new Option(text,value,true,true));
    show.chooseman.options.remove(i)
    }
    }
    }
    function popfromarray()
    {
    manarray.pop();问题2:在这里如何取出manarray中的最后一个值,并且添加到show.chooseman中去?
    len=manarray.length
    text=manarray[len-1]
    value=manarray[len-1]
    show.chooseman.options.add(new Option(text,value,true,true));
    }
      

  2.   

    呵呵,写错了show.all.docreciever.options.add(new Option(text,value,true,true));
    改为:
    show.docreciever.options.add(new Option(text,value,true,true));