实在不行就只好上传个字符串了
定义一个hidden的input,存放select里所有option的value值连成的字符串,到了需要的地方再解析

解决方案 »

  1.   

    <script language="javascript">
    var products_function = document.all.products_function.options;
    var len = document.all.products_function.options.length;
    for (var i=0;i<len;i++)
     {
    if(document.all.products_function.options[0].text=="")  
    document.all.products_function.options.remove(0);
    else
    products_function = document.all.products_function.options[i].concat(',');
    }
    </script>
      

  2.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <SCRIPT LANGUAGE="JavaScript">
    <!-- function addItem(source,target,maxItem,allowRepeat)
    {
    if(!allowRepeat)allowRepeat = false;
    if(!source || !target || source.tagName!='SELECT' || target.tagName!='SELECT') return false;for(var i=0; i<source.options.length;i++)
    {
    if(source.options[i].selected)
    {
    if(!allowRepeat && findItem(target,source.options[i].text,source.options[i].value,1)!=null)
    alert("\"" + source.options[i].text + "\"" + "已經存在!");
    else
    target.options.add(new Option(source.options[i].text,source.options[i].value));
    }
    }
    }
    function delItem(source)
    {
    if(!source || source.tagName!='SELECT') return false;
    for(var i=source.options.length-1; i>=0; i--)
    {
    if(source.options[i].selected) source.options.remove(i);
    }
    }function findItem(target,text,value,flag)
    {
    if(!flag) flag = 0;
    if(!target || target.tagName!='SELECT') return null;
    for(var i=0;i<target.options.length;i++)
    {
    if(flag==1 && target.options[i].value==value) 
    return target.options[i];
    if(flag==2 && target.options[i].text==text)
    return target.options[i];
    if(target.options[i].text==text&&target.options[i].value==value) 
    return target.options[i];
    }
    return null;
    }function selectAll()
    {
    var obj = document.getElementById("products_function");
    for (var i=0; i<obj.options.length; i++)
    {
    obj.options[i].selected = true;
    }}
    //-->
    </SCRIPT>
    </HEAD><BODY>
    <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr>
    <td width="10%" valign="top">
    <select name="products_function1" size="5" style="width:12em" multiple id="products_function1" ondblclick="addItem(this,document.all.products_function)">
    <option value="1">防雨</option>
    <option value="2">防震</option></select> 
    </td>
    <script language="javascript"> if(document.all.products_function1.options[0].text=="") document.all.products_function1.options.remove(0); </script> <td width="10%" align="center"><input type="button" name="enter" value="=&gt;" onclick="addItem(document.all.products_function1,document.all.products_function)"><br>
    <input type="button" name="remove" value="&lt;=" onclick="delItem(document.all.products_function)">
    </td>
    <td width="20%">
    <select name="products_function" size="5" style="width:12em" multiple id="products_function" ondblclick="delItem(this)">
    <option value="" SELECTED></option></select>
    </td>
    <script language="javascript">
    if(document.all.products_function.options[0].text=="") document.all.products_function.options.remove(0); </script>
    <td><input type="submit" value="submit" onclick="selectAll();return abc()"></td> </tr>
    </table>
    <div id="div1"></div>
    </BODY>
    </HTML>
    <script language="javascript">
    function abc(){
    var products_function = document.all.products_function.options;
    var len = document.all.products_function.options.length;
    for (var i=0;i<len;i++)
     {
    if(document.all.products_function.options[0].text=="")  
    document.all.products_function.options.remove(0);
    else
    document.getElementById("div1").innerHTML += "選択項 番号" + i + ": "
     + " value = " + document.all.products_function.options[i].value 
     + " text = " + document.all.products_function.options[i].innerText
     + " <br> " ;
    }
    return false;
    }
    </script>