Sure ... ok we're going to have to work things a little different then ... If like my previous example you're using tables to show all of the data, what we'll need to do is a short recode ...
The code now adds the row as before (even though I added a couple of additional cells) , but this time I left a row at the bottom free which holds the values of the 3rd and 4th columns. Is that what you were looking for ??
<html>
<head>
<script>
function addRow1(){
var cost
var payment = 0
var t = document.getElementById("someID")
var trows = t.rows
var r = document.getElementById("someID").insertRow(trows.length - 1);
var c1 = r.insertCell(0)
var c2 = r.insertCell(1)
var c3 = r.insertCell(2)
var c4 = r.insertCell(3)
c1.innerHTML = "Random " + trows.length
c2.innerHTML = "Service"
c3.innerHTML = "12"
c4.innerHTML = "0"
var cost = 0
// Set the row attribute
r.setAttribute("id", document.getElementById('someID').rows.length)
var count=0;
for (i=1; i < trows.length -1; i++) {
for (j=0; j < trows(i).cells.length; j++) {
}
cost += parseInt(trows(i).cells(2).innerText)
payment += parseInt(trows(i).cells(3).innerText)
}
trows(trows.length - 1).cells(1).innerHTML = "£" + cost
trows(trows.length - 1).cells(2).innerHTML = "£" + payment
}
</script>
</head>
<body>
<a href="javascript:addRow1()">Add</a>
<table id="someID">
<tr>
<th>Name</th>
<th>Payment Type</th>
<th>Cost 1</th>
<th>Payment 1</th>
</tr>
<tr>
<td>BootCom</td>
<td>Works Completed</td>
<td>0</td>
<td>200</td>
</tr>
<tr>
<td colspan="2"> </td>
<td>0</td>
<td>200</td>
</tr>
</table>
</body>
</html>