# Calculate Total of Items in table

On a web page, an order form in a table, before user clicks on "submit/order", I want to auto summarize line items and order total (showing order table on both top and bottom of page).

example:

Order Total: \$36
Item A \$4  user puts in quantity 3 = auto total \$12
Item B \$6 user puts in quantity 4 = auto total \$24
Order Total: \$36
###### Who is Participating?

Author Commented:
I found the code and example at: http://www.mcfedries.com/javascript/ordertotals.asp
0

PluritechnicianCommented:
var AUTO_TOTAL_A = parseFloat(document.getElementById("ItemAID").value) * parseInt(document.getElementById("QuantityItemAID").value);
var AUTO_TOTAL_B = parseFloat(document.getElementById("ItemBID").value) * parseInt(document.getElementById("QuantityItemBID").value);
var ORDER__TOTAL = (AUTO_TOTAL_A + AUTO_TOTAL_B).toFixed(2);
document.getElementById("autototalIDA").value = AUTO_TOTAL_A;
document.getElementById("autototalIDB").value = AUTO_TOTAL_B;
document.getElementById("ordertotalID").value = ORDER__TOTAL;

0

Author Commented:
I don't get what I am suppose to do with that, do I have to do ItemAID, ItemBID for each row in the table? And also for the ORDER_TABLE? The number of rows are dynamic each time.
0

Commented:
Do you have an example of the html of the table layout you suggest? Otherwise we guess, it's a little off and we have to write code again to obtain the result you want. I understand the number of rows is dynamic, but how are the cells laid out. Show a sample html table layout and it can be done in a few min.
0

Author Commented: