比如说  个数    单价    总价
         2       50      100
         2       40      80 (这行是动态添加的行)
每行的ID 都是_sum[i]格式的
然后有个总计金额:是把每行的总价坐求和处理
针对这个总金额怎么做 
求大神指导!!!

解决方案 »

  1.   

    <tr>
    <td  align="center" class="alt"><span>序  号</span></td>
    <td  align="center" class="alt"><span>品牌型号</span></td>
    <td  align="center" class="alt"><span>数  量</span></td>
    <td  align="center" class="alt"><span>单          位</span></td>
    <td  align="center" class="alt"><span>单  价</span></td>
    <td  align="center" class="alt"><span>总  价</span></td>
    <td  align="center" class="alt"><span>特殊选购件说明</span></td>
    </tr>
    <tr>
    <td ><input type="text"  class="input2" name="" value="1" size=2/></td>
    <td ><input type="text"  class="input5" name="pactList[0].brand" size=40/></td>
    <td ><input type="text"  class="input5" name="pactList[0].count" size=5 id="_count[1]" onchange="e(this)"/></td>
    <td ><input type="text"  class="input5" name="pactList[0].unit" size=5/></td>
    <td ><input type="text"  class="input5" name="pactList[0].price" size=20 id="_price[1]" onchange="this.value=cc(this.value);f(this)" /><span>¥</span></td>
    <td ><input type="text"  class="input5" name="pactList[0].sumCount" size=20 readonly id="_sumCount[1]" onfocus="math(this)"/><span>¥</span></td>
    <td ><input type="text"  class="input5" name="pactList[0].content" size=145/></td>
    </tr>
      

  2.   

    var i=1;
      var j=2;
      function addRow(){ 
    var newTr = table2.insertRow(); 
    var newTd0 = newTr.insertCell();
    var newTd1 = newTr.insertCell();
    var newTd2 = newTr.insertCell();
    var newTd3 = newTr.insertCell();
    var newTd4 = newTr.insertCell();
    var newTd5 = newTr.insertCell();
    var newTd6 = newTr.insertCell();
    newTd0.innerHTML ='<td ><input type="text"  class="input2" name="" value="'+j+'" size=2/></td>';
    newTd1.innerHTML ='<td ><input type="text"  class="input5" name="pactList['+i+'].brand" size=40/></td>';
    newTd2.innerHTML ='<td ><input type="text"  class="input5" name="pactList['+i+'].count" size=5 id="_count['+i+']" onchange="e(this)"/></td>';
    newTd3.innerHTML ='<td ><input type="text"  class="input5" name="pactList['+i+'].unit" size=5/></td>';
    newTd4.innerHTML ='<td ><input type="text"  class="input5" name="pactList['+i+'].price" size=20 id="_price['+i+']" onchange="this.value=cc(this.value);f(this)"/><span>¥</span></td>';
    newTd5.innerHTML ='<td ><input type="text"  class="input5" name="pactList['+i+'].sumCount" size=20 readonly id="_sumCount['+i+']" onfocus="math(this)"/><span>¥</span></td>';
    newTd6.innerHTML ='<td ><input type="text"  class="input5" name="pactList['+i+'].content" size=145/></td>';
    i++;
    j++;

    }
      

  3.   

    <td  align="center" class="alt" ><span>合计金额</span></td>
    <td  align="center" ><input type="text" class="input2" name="pgood.sumCount" id="_sum4" onclick="c()"/></td>我要在这个合计金额上算出总的价格
    我现在是不知道怎么动态抓去上面的总价的ID
      

  4.   

    http://bbs.csdn.net/topics/390303822
    这个不行么?