Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 具有输入标记的多行表_Php_Javascript_Jquery_Asp.net_Web Applications - Fatal编程技术网

Php 具有输入标记的多行表

Php 具有输入标记的多行表,php,javascript,jquery,asp.net,web-applications,Php,Javascript,Jquery,Asp.net,Web Applications,在发票表单中,我有一个25行的表格 <table border="1" align="center"> <thead> <tr> <th>#</th> <th>Item Name</th> <th>Item Code</th> <th>Quantity</th> <th>Price</th> <th>Amount</th&

在发票表单中,我有一个25行的表格

<table border="1"  align="center">
<thead>
<tr>
<th>#</th>
<th>Item Name</th>
<th>Item Code</th>
<th>Quantity</th>
<th>Price</th>
<th>Amount</th>-->
<th>Net Amount</th>
</tr>
</thead>

 <tbody>
 <?php for($i=1 ; $i<=25 ; $i++) { ?>

 <tr>
 <th> <?php echo "$i"; ?> </th>
 <td><input id="itemName"  onBlur="loadAllField()" class="orderInput" type="text" align="center" ></td>
 <td><input id="itemCode" onBlur="loadAllField()"  class="orderInput" type="text" align="center" ></td>
<td><input id="quantity" class="orderInput" onKeyPress="calqtyprice()" type="text"         align="center" ></td>
<td><input id="price" class="orderInput" type="text" align="center"  readonly></td>
<td><input id="netAmount" class="orderInput" type="text" align="center" readonly ></td>
</tr>

<?php } ?>
</tbody>

<tfoot>
<tr>
<td id="tdTotal" colspan="2" style="font-size:16px"> <b>Totals</b></td>
<td id="totalspace" colspan="3"> </td>
<td><input id="netTotalAll" class="orderInput" type="text" readonly> </td>
</tr>


</tfoot>
</table>

<p id="msg" align="center"> </p>
问题是如何遍历每一行,从输入中获取值,计算并在最后一行显示净值


或者本教程有什么机制。

假设您创建的元素具有唯一的
id
,如下所示

<input type="text" id="price_1"
然后在javascript循环中

for ( i=1; i<=25; i++) {
   var price = document.getElementById("price_" + i);

用于(i=1;i您正在循环中创建具有相同ID的元素。ID是唯一的。5分钟的宽限期是什么?@stano sir哪个i==25打印无行???@DevZer0我在javascript函数中这样做,但在html中不起作用。在input tag onblur函数中不调用函数。如何解决这个问题…?@WaleedEhsan您需要什么状态帮助?@WaleedEhsan在这里,我希望它能有用:-)
<input type="text" id="price_<?php echo $i; ?>" 
for ( i=1; i<=25; i++) {
   var price = document.getElementById("price_" + i);