пишу вот так
<script>
function sum() {
var table = document.getElementById('table1'),
trcount = table.rows.length,
rez = 0;
for(var i=2; i<=trcount-1; i++) {
if(document.getElementById('result'+i).innerHTML != null) {
rez = rez + document.getElementById('result'+i).innerHTML*1;
};
};
document.getElementById('r').innerHTML = rez;
};
</script>
<tr>
<td>1</td>
<!-- td>1</td -->
<td>Бульон куриный</td>
<td><input class="in" id="ed1" name="val[1]" type="number" min="0" onchange="getElementById('result1').innerHTML=(parseFloat(getElementById('price1').innerHTML)*document.getElementById('ed1').value).toFixed(2);"></td>
<td>л</td>
<td align="right" id="price1">11.00</td>
<td align="right" id="result1"></td>
</tr>
<tr>
<td>2</td>
<!-- td>2</td -->
<td>Бульон мясной</td>
<td><input class="in" id="ed2" name="val[2]" type="number" min="0" onchange="getElementById('result2').innerHTML=(parseFloat(getElementById('price2').innerHTML)*document.getElementById('ed2').value).toFixed(2);"></td>
<td>л</td>
<td align="right" id="price2">11.00</td>
<td align="right" id="result2"></td>
</tr>
<tr>
<td>3</td>
<!-- td>3</td -->
<td>Сыворотка</td>
<td><input class="in" id="ed3" name="val[3]" type="number" min="0" onchange="getElementById('result3').innerHTML=(parseFloat(getElementById('price3').innerHTML)*document.getElementById('ed3').value).toFixed(2);"></td>
<td>л</td>
<td align="right" id="price3">10.00</td>
<td align="right" id="result3"></td>
</tr>
<tr>
<td>4</td>
<!-- td>4</td -->
<td>Варенье абрикосовое</td>
<td><input class="in" id="ed4" name="val[4]" type="number" min="0" onchange="getElementById('result4').innerHTML=(parseFloat(getElementById('price4').innerHTML)*document.getElementById('ed4').value).toFixed(2);"></td>
<td>шт</td>
<td align="right" id="price4">200.00</td>
<td align="right" id="result4">1123</td>
</tr>
<tr>
<td>5</td>
<!-- td>5</td -->
<td>Варенье айвовое</td>
<td><input class="in" id="ed5" name="val[5]" type="number" min="0" onchange="getElementById('result5').innerHTML=(parseFloat(getElementById('price5').innerHTML)*document.getElementById('ed5').value).toFixed(2);"></td>
<td>шт</td>
<td align="right" id="price5">200.00</td>
<td align="right" id="result5">222</td>
</tr>
<tr>
<td>6</td>
<!-- td>6</td -->
<td>Варенье виноградное</td>
<td><input class="in" id="ed6" name="val[6]" type="number" min="0" onchange="getElementById('result6').innerHTML=(parseFloat(getElementById('price6').innerHTML)*document.getElementById('ed6').value).toFixed(2);"></td>
<td>шт</td>
<td align="right" id="price6">200.00</td>
<td align="right" id="result6">333</td>
</tr>
<tr>
<td>7</td>
<!-- td>7</td -->
<td>Варенье вишневое</td>
<td><input class="in" id="ed7" name="val[7]" type="number" min="0" onchange="getElementById('result7').innerHTML=(parseFloat(getElementById('price7').innerHTML)*document.getElementById('ed7').value).toFixed(2);"></td>
<td>шт</td>
<td align="right" id="price7">200.00</td>
<td align="right" id="result7">222</td>
</tr>
<tr>
<td> </td>
<!-- td> </td -->
<td><strong>
<input type="button" onclick="sum()" value="Итого:">
<span id="r">0</span></strong></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
Не могу победить JS чтоб складывался последний столбец