嗨,我有列出某些销售价值的表格。加载销售后,我想显示所有值的总和。现在它工作正常,但我必须改变一些值,它会显示总数。我想要做的也是在加载表单时显示总数。
<form id="sales" action="" >
<table class="salesTable" border="1" cellpadding="0" cellspacing="0">
<tbody>
{{#each items}}
<tr class="">
<td><input type="abd" name="{{=id}}" id="{{=id}}" value='{{=sales}}' onchange="updateTotal(this.form)" /></td>
</tr>
<tr>
<td style="font:bold">Total</td>
<td><input type="abd" name="sum" onfocus="this.blur()" readyonly value=""/> </td>
</tr>
</tbody>
</table>
</form>
jquery函数是
function updateTotal(formObj) {
var total = 0;
total += parseInt(formObj.s1011.value, 10)
total += parseInt(formObj.s1018.value, 10)
total += parseInt(formObj.s1019.value, 10)
formObj.sum.value = total
}
请让我知道如何更改它,以便在引导表单时它也会显示值的总和。谢谢