使用javascript计算表单中动态生成的行的总价格?

时间:2014-03-26 06:21:09

标签: javascript

实际上我想计算使用jquery每天生成的每一行的总价格。行生成usnig dynamicForm(" #plus","#minus",{limit:20} );.请帮我计算总价。

                    <form action="previewStock.jsp" method="post" onsubmit="return validateAddStock()">
                        <table align="center" style="width: 900px;">
                         <tr>
                             <td colspan="10" align="center">
                                Supplier Name : <select class="hoverr" name="supplierName">
                                    <option value="unknown">Unknown</option>


                                </select>

                                <!--<td>

                                Supplier Mob.</td><td><select class="hoverr" name="supplierMob">
                                        <option>Unknown</option>
                                    </select></td>-->
                                    <input type="text" name="invoiceId" placeholder="Enter Invioce Id" >
                                     <a href="addSupplier.jsp?menuId=3"><input type="button" name="addSupplier" id="addSupplier" value="Add New Supplier"></a>
                             </td>
                    </tr>
                    <tr><td colspan="10" align="center"><hr></td></tr>
                        <tr style="background: brown; color:  #ffffff;">
                                <td>Item Name</td>
                                <td>Quantity</td>
                                <td>Unit</td>
                                <td>Price/Unit</td>
                                <td>Total Price</td>
                                <td>Purchase Date</td>
                                <td>Expiry Date</td>
                                <td>MRP</td>
                                <td>Category</td>
                                <td>Description</td></tr>
                            <input type="hidden" name="menuId" value="1"/>
                        <tr id="duplicate">
                        <td><input type="text" name="itemName" id="itemName" value=""  required="true" placeholder="Item Name" class="hoverr"/></td>
                            <td><input type="text" name="quantity"id="quantity"  value="" required="true" pattern="[0-9]" size="5" placeholder="Qty." class="hoverr"/></td>
                                             <td>
                                                 <select id="unit" name="unit" required="true" class="hoverr">
                                                          <option value="0">Select</option>
                                                          <option value="Kg">Kg</option>
                                                          <option value="Packet">Packet</option>
                                                          <option value="Litre">Litre</option>
                                                          <option value="Meter">Meter</option>
                                                  </select></td>
                                                        <td><input type="textr" name="pricePerUnit" id="pricePerUnit" size="7" value="" required="true"  placeholder="Price P/U."  class="hoverr"/></td>
                                             <td><input type="text" name="totalPrice" id="totalPrice" size="7" value="" placeholder="Tot. Price" class="hoverr"/></td>
                                             <td><input type="date" name="purchgeDate" id="purchageDate" size="12" value="" placeholder="Pur. Date" onfocus="showCalendar('',this,this,'','holder1',0,30,1)"></td>
                                             <td><input type="date" name="expiryDate" id="expiryDate"  size="12" value="" placeholder="Exp. Date" onfocus="showCalendar('',this,this,'','holder1',0,30,1)"></td>
                                             <td><input type="number" name="MRP" id="MRP" size="14" value="" placeholder="MRP" /></td>
                                             <td><select name="category" class="hoverr" id="category"><option value="0">Select</option></select></td>
                                             <td><textarea name="description" id="description" class="textareaItem" placeholder="Description Here" cols="15" rows="1" class="hoverr"/></textarea></td>
                                             <td><a href="#" id="minus" style="color: black;" ><img src="images/delete.png" width="20" style="float: left;" title="Delete Row"></a></td><td><a href="#" id="plus"><img src="images/addItem.png" width="17" style=" float: right;" title="Add Row"></a></td>
                    </tr>
                        <tr><td><div style="display: none; margin-left: 680px;" id="total">Grand Total:<lable for="grandTotal" id="grandTotal"><img src="images/rupee.png" height="14"> <input type="text" name="grandTotal"></lable></div></td></tr><br><br>
                        <tr><td colspan="10" align="center"><hr></td></tr>
                        <tr><td colspan="10" align="center"><input type="submit" name="submit" value="Save">&nbsp;&nbsp;&nbsp;<input type="reset" name="reset" value="Reset"></td></tr>
                        </table>

0 个答案:

没有答案