Calculate input fields ... give total

I have a dynamically generated form that's being called from the database using ASP.  The amount of rows is dependent upon how many entries exist in the database.  In this form people will enter a meter amount and then a total amount (It's a utility database).  What I want to happen is the total amount to be added to a running Total Amount for the page.  I know this has to be a javascript function but I don't know how to go about doing it.  I've included some of the code...

<form action="Enter.asp?Search=1" method="post" name="Step2">
<input type="hidden" value="<%= Property %>" name="Property">
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
      <td width="35%" valign="top" align="left" class="newstext"><% IF icount = 0 then %><b><%= objRS("Service Address") %></b><br><%= objRS2("Account Number") %><% Else %>&nbsp;<% End IF %></td>
      <td width="15%" align="center" class="normal"><%= objRS2("Meter Number") %></td>
      <td width="10%" align="center" class="normal">Gas</td>
      <td width="20%" align="center" class="normal"><input type="text" class="normal" name="Used<%= var %>" size="4" maxlength="4"></td>
      <td width="20%" align="center" class="normal">$<input type="text" class="normal" name="Total<%= var %>" size="6" maxlength="6"></td>
icount = icount + 1
icount = 0
var = var + 1
      <td width="100%" colspan="5" class="normal" align="center"><hr></td>

'  Lots more here ... blah blah blah

      <td width="15%" colspan="4" align="center" class="newstext"><b><%= Property %> Grand Total:</b></td>
      <td width="15%" align="center" class="newstext">$<input type="text" name="GrandTotal" class="normaltxt" size="5" maxlength="5" readonly></td>

How to I get the Grand Total column to add dynamically with each Total entry?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

please post some sample generated html
BSitkoAuthor Commented:
Address Meter # Type Therm/Kwh Total
22024-00013                              N/A         Electric  $ _______
                                                503585     Gas       $ _______

09606-56017                             N/A          Electric    $______

72024-08014                             N/A          Electric    $______
                                                233236     Gas         $______


GRAND TOTAL                                                        $_________

Note the underlined areas are actually textboxes.
Online example:

For this example, you must apply the ID attribute to all your total fields, from total1, total2, so on, and the ID of grandtotal to where you want the answer to go.  Then assign the onkeyup events to each of the total fields.

function updateTotal() {
      var el=true, total=0;
      for(var i=1; true; i++) {
            if (!el) break;
      var tot=document.getElementById("grandtotal");

<input id="total1" onkeyup="javascript:updateTotal();"><br>
<input id="total2" onkeyup="javascript:updateTotal();"><br>
<input id="total3" onkeyup="javascript:updateTotal();"><br>

<input id="grandtotal" readonly="readonly">


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BSitkoAuthor Commented:
Some tweaks (the ID thing) and it works perfectly.  THANKS!
BSitko , I meant the actual HTML that the ASP sends down to a page , run an example and post the HTML source of the page generated
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.