0
我通過ajax提交表單。目前,我放在一起後的數據是這樣的:如何通過ajax發送多個選擇選項
for(i=0; i<document.formname.elements.length; i++){
if(document.formname.elements[i].type=='checkbox' && document.formname.elements[i].checked!=true){continue;}
if (i>0){data = data + "&";}
data = data + document.formname.elements[i].name + "=" + encodeURIComponent(document.formname.elements[i].value);
}
這個工作,直到我改變了我的選擇框之一,選擇多。此代碼片段僅獲取所選值之一。
想象我有這個在我的表格:
<select name="selectme[]" multiple>
<option value="">Select Something</option>
<option value="987987">Choice 1</option>
<option value="35987">Another Choice</option>
<option value="98987">Choice 3</option>
</select>
我將如何檢測和收集其他選擇?
[點擊一個按鈕使用JavaScript獲取多選框的所有選定值的可能重複](http://stackoverflow.com/questions/5866169/getting-all-selected-values-of-a-多選框,當點擊一個按鈕,ü) – TecBrat
是的,我標記了自己的問題。 :) – TecBrat
很高興我花了時間回答它然後:/ – pennstatephil