問一個JS 問題,我現在有一個一拉多個框,我現在將左邊的數據移到右邊框中去後,怎麼樣才能到提交的時候將右邊的多個數據一起提交上取呢,我現在只能提交最後一個數據,不能抓到多個數據,該怎麼辦啊,多謝了啊
代碼如下:
<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>&nbsp;</td> </tr>
</table>我將左邊的值移2或多個到右邊去后﹐提交時能看見將右邊的數據全部高亮度選中﹐可到輸出頁面﹐我就只能看到最后一個數據的value值啊這是怎么回事呢﹐我該怎么做才能將選中的數據全部輸出來呢﹗?
TKS 
 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;
}}腳本就這些,onclick 觸發selectall()