js怎么识别list的参数下标
_起飞的猪 2018-06-19 09:03:38 $(document).ready(function(){
var i= 0;
$(".newone").click(function(){
i=i+1;
var options=$("#select option:selected").text();
var value = document.getElementById('account').value;
var value1 = document.getElementById('des').value;
var list =i-1;
var $newPro ='';
$newPro = '<tr>'
+'<td style="width: 150px;">'
+'<input name="detailList[list].item" type="hidden" value="options">'
+options
+'</td>'
+'<td style="width: 150px;">'
+'<input name="detailList[list].account" type="hidden" value="value">'
+value
+'</td>'
+'<td style="width: 150px;">'
+'<input name="detailList[list].des" type="hidden" value="value1">'
+value1
+'</td>'
+'<td style="width: 150px;">'
+'<img class=\'del\' src="images/del.png" onclick="rep(this)"/>'
+'</td>'
+'</tr>';
$("table").append($newPro);
var totalAccount=0;
var old = document.getElementById("account2").value;
totalAccount = parseFloat(totalAccount)+ parseFloat(old) + parseFloat(value) ;
document.getElementById("account2").value=totalAccount;
$("#account").val("");
$("#des").val("");
$("#select").val("1");
});
我用SpringMVC在后台无法获取detailList这个集合的值吧 并且报错
Invalid property 'detailList[list]' of bean class [com.entity.Cvoucher]: Invalid index in property path 'detailList[list]'; nested exception is java.lang.NumberFormatException: For input string: "list"