# Auto Sum of Input boxes

Hi,

Below codes create 3 columns and 4 rows. Let’s just call Column A,B,C. C being the last column on the right (subtotal). The Total box sums up all the sub totals

I would like help on adding another code to the following logics:

• the value put in Column A must always be multiplied by 5 and the product should appear in column C
example:
If value 5 is entered in Column A, the subtotal in column © should have 25.

• the value put in Column B must always be multiplied by 10 and the product should appear in the column C
example:
If value 3 is entered in Column B, the subtotal in column © should have 55 (result. from adding 25 and 30)

+++++++++++++++++++++++++++++++++

``````<script type="text/javascript">
var rows;
{
rows=document.getElementById('table1').getElementsByTagName('tr');
var Numberofrows = document.getElementById("table1").rows.length
alert("found rows : " + Numberofrows)

for(var i=0;i<rows.length;i++)
{
alert (document.title = "Row : " + i + " Column : " + i)
{
rows[i].getElementsByTagName('input')[j].onkeyup=calc;
}
}
}

function calc()
{
var tot=0;
for(var i=0;i<rows.length;i++) // loop until hits the number of rows which is 4. so this will loop 4 times.
{
var linetot=0;
{

tot+=linetot;
}
document.getElementById('total').value =tot
} /*end of function CALC()*/

</script>

<body>
<form>
<table id="table1" width="600" border="0" cellspacing="1" cellpadding="1">
<tr id = "Row1">
<td style="width:80px"><input type="number" id="row1Col1"></td>
<td><input type="number" id="row1Col2"></td>
<td>=<input type="number" id="linetot1"></td>
</tr>
<tr id="Row2">
<td><input type="number">+</td>
<td><input type="number"></td>
<td>=<input type="number"></td>
</tr>
<tr id="Row3">
<td><input type="number">+</td>
<td><input type="number"></td>
<td>=<input type="number"></td>
</tr>