Here is the code snippet from my HTML file:
<tr>
<td><input id="z1" type="number"
oninput="calculateSubTotal()">
</td>
<td>Shirts - WASH - Qty 1 to 4</td>
<td>2.50 ea</td>
<td></td>
</tr>
This is how my Javascript function looks like:
function calculateSubTotal() {
var subTotal = (getTableOnePrice() + getTableTwoPrice() + getTableThreePrice() + getTableFourPrice());
document.getElementById("subtotal").innerHTML = subTotal.toFixed(2);
return subTotal;
}
An example of one of the functions in my script is this:
function getTableTwoPrice(){
var ba = document.getElementById("y1").value * 6.00;
var bb = document.getElementById("y2").value * 1.25;
var bc = document.getElementById("y3").value * 4.00;
var bd = document.getElementById("y4").value * 6.00;
var be = document.getElementById("y5").value * 7.00;
var bf = document.getElementById("y6").value * 8.00;
var bg = document.getElementById("y7").value * 9.00;
var bh = document.getElementById("y8").value * 5.00;
var bi = document.getElementById("y9").value * 13.00;
var bj = document.getElementById("y10").value * 10.00;
var bk = document.getElementById("y11").value * 12.00;
var bl = document.getElementById("y12").value * 14.00;
var bm = document.getElementById("y13").value * 16.00;
var bn = document.getElementById("y14").value * 10.00;
var tableTwoTotal = ba + bb + bc + bd + be + bf + bg + bh + bi + bj + bk + bl + bm + bn;
return tableTwoTotal;
}