根据不同的产品id获得不同的下拉选项 (option传多值)
<td> 没有 value
所以要在<td>里面加上input 同时text 为hidden这样就不会显示value的值
<td><select id='goodRefSuppliers_${s.index}' style='width: 100px;'><option value=''>--请选择--</option> <c:forEach var='goodRefSuppliers' items='${goodRefSuppliersList}'> <c:if test ="${goodRefSuppliers.prdInfo == prd}"> <option id='${goodRefSuppliers.suppliers.id}' value='${goodRefSuppliers.suppliers.name},${goodRefSuppliers.suppliers.id}'>${goodRefSuppliers.suppliers.name} </option> </c:if> </c:forEach> </select> </td>
var chk_value = []; function jqchk() { //jquery获取复选框值 $('input[name="id"]:checked').each(function() { var ip = $(this).attr('id'); var val = $(this).val(); //alert(val); var unit = $('#unit_'+ip).val(); var goodRefSuppliers = $('#goodRefSuppliers_'+ip).val(); //alert(goodRefSuppliers); val = val + "," + unit+"," +goodRefSuppliers; chk_value.push(val); }); if (chk_value.length == 0) { alert('没有选择任何数据。'); return false; } return true; } function ext(){ if(jqchk()){ var str = ""; for(var i=0;i<chk_value.length;i++){ var ips = parseInt(Math.random() * new Date().getTime()); str = str + "<tr id='gradeTr_"+ips+"'>" +"<td>" + chk_value[i].split(",")[1] + "</td>" +"<td>" + chk_value[i].split(",")[2] + "</td>" +"<td>" + chk_value[i].split(",")[3] + "</td>" +"<td><input type='hidden' id='suppliers_"+ips+"' value=" + chk_value[i].split(",")[5] + "> "+ chk_value[i].split(",")[4] +"</td>" +"<td><select id='gradeCode_"+ips+"' style='width: 100px;'><option value=''>--请选择--</option><c:forEach var='grade' items='${productGradeList}'><option value='${grade.propertyCode}'>${grade.propertyValue}</option></c:forEach></select></td>" +"<td><select id='inventoryStatus_"+ips+"' style='width: 100px;'><option value=''>--请选择--</option><c:forEach var='status' items='${inventoryStatusList}'><option value='${status.propertyCode}'>${status.propertyValue}</option></c:forEach></select></td>" +"<td><select id='inventoryType_"+ips+"' style='width: 100px;'><option value=''>--请选择--</option><c:forEach var='inventoryType' items='${inventoryTypeList}'><option value='${inventoryType.propertyCode}'<c:if test="${inventoryType.propertyValue=='备件库存'}">selected</c:if>>${inventoryType.propertyValue}</option></c:forEach></select></td>" +"<td><input type='text' id='itemKey_"+ips+"' value='无'/></td>" +"<td><input type='text' id='quantity_"+ips+"' onkeyup='javascrit:IsNum(this)'/></td>" +"<td align='center'><input type='hidden' name='prdId' value='"+chk_value[i].split(",")[0]+"' id='"+ips+"'/><a href='javascript:deleteGoods("+ips+")'>删除</a></td></tr>"; }//for closePopup(); parent.refreshMain(str); //alert(str); parent.hideErrorMsg(); }//if }
自信与努力 用心坚持