0
内我已填充以这种方式(我使用grider jQuery插件)无法从表
<table border="0" id="table_reserved_price_list">
<tbody>
<tr class="noedit">
<th class="testClass" col="cod_products">Codice Prodotto</th>
<th class="testClass" col="products">Prodotto</th>
<th class="testClass" col="cat_products">Categoria</th>
<th class="testClass" col="brand">Brand</th>
<th class="testClass" col="discount">Sconto Percentuale</th>
</tr>
<tr>
<td>
<input type="text" onchange="ajax_showOptions(this,'get_code_prod',event)" onkeyup="ajax_showOptions(this,'get_code_prod',event)" style="width:60px;" value="" class="input-small input_cod_products" name="input_cod_products[0]">
</td>
<td>
<input type="text" onchange="ajax_showOptions(this,'get_code_prod',event)" onkeyup="ajax_showOptions(this,'get_prod',event)" style="width:60px;" value="" class="input-small" name="input_products[0]">
</td>
<td>
<input type="text" onkeyup="ajax_showOptions2(this,'get_cat_prod',event)" style="width:60px;" value="" class="input-small" name="input_cat_products[0]">
</td>
<td>
<input type="text" onkeyup="ajax_showOptions2(this,'get_brand_prod',event)" value="" class="input-small" name="input_brand[0]">
</td>
<td>
<input type="text" style="width:10px;" value="" class="input-small" name="input_discount1[0]">
-
<input type="text" style="width:10px;" value="" class="input-small" name="input_discount2[0]">
-
<input type="text" style="width:10px;" value="" class="input-small" name="input_discount3[0]">
</td>
<td>
<a class="addRow" href="#"><img width="12px" border="0" src="icons/add.png"></a>
<a class="delete" href="#"><img border="0" src="icons/delete.gif"></a>
</td>
</tr>
<tr>
<td>
<input type="text" onchange="ajax_showOptions(this,'get_code_prod',event)" onkeyup="ajax_showOptions(this,'get_code_prod',event)" style="width: 60px;" value="" class="input-small input_cod_products" name="input_cod_products[1]">
</td>
<td>
<input type="text" onchange="ajax_showOptions(this,'get_code_prod',event)" onkeyup="ajax_showOptions(this,'get_prod',event)" style="width: 60px;" value="" class="input-small" name="input_products[1]">
</td>
<td>
<input type="text" onkeyup="ajax_showOptions2(this,'get_cat_prod',event)" style="width: 60px;" value="" class="input-small" name="input_cat_products[1]">
</td>
<td>
<input type="text" onkeyup="ajax_showOptions2(this,'get_brand_prod',event)" value="" class="input-small" name="input_brand[1]">
</td>
<td>
<input type="text" style="width: 10px;" value="" class="input-small" name="input_discount1[1]">
-
<input type="text" style="width: 10px;" value="" class="input-small" name="input_discount2[1]">
-
<input type="text" style="width: 10px;" value="" class="input-small" name="input_discount3[1]">
</td>
<td>
<a class="addRow" href="#"><img width="12px" border="0" src="icons/add.png"></a>
<a class="delete" href="#"><img border="0" src="icons/delete.gif"></a>
</td>
</tr>
</tbody>
</table>
我做了一个脚本来检索值(在这种情况下表中检索输入值该产品的代码),然后把它放在另一个输入元素(在这种情况下,产品的,我不能够从第二行获得的名称的名称)
if (!inputObj)
inputObj=this;
var tmpValue = inputObj.innerHTML;
if (ajax_list_MSIE)
tmpValue = inputObj.innerText;
else
tmpValue = inputObj.textContent;
if (!tmpValue)
tmpValue = inputObj.innerHTML;
ajax_list_activeInput.value = tmpValue;
if (!isNaN(tmpValue)) {
//We retrive the code and then put the product name
var url = ajax_list_externalFile + '?get_prod_name' + '=1&letters=' + tmpValue;
var title = "";
$.post(url, {
title: title
},
function(data){
$('[name=input_products\\[0\\]]').val(data);
});
}
Unfortunally,它得到的值仅从第一行开始。你可以帮我吗?
感谢
谢谢杰克的答案,但我需要把值放到名为“input_products”的输入。我如何做到这一点?谢谢! – user1259178 2012-03-09 13:38:33
查看我的更新回答。 – jack 2012-03-09 13:48:28
不幸的是,只有第一行名为“input_products [0]”,第二行我看到它放在第一行和第二行的值(“input_products [0]”,“input_products [1]”) – user1259178 2012-03-09 14:31:21