I have a bunch of numbers that are being inserted into an html file and I want to calculate the total and place it in a cell at the bottom of the table. How would I do this in VBScript or JavaScript???
Printable View
I have a bunch of numbers that are being inserted into an html file and I want to calculate the total and place it in a cell at the bottom of the table. How would I do this in VBScript or JavaScript???
Quote:
I have a bunch of numbers that are being inserted into an html file
How?
Please explain.
The numbers come to the page from an Oracle view using SQL statements.
Are they numbers written directly to the page or are they in textboxes etc?
Directly to the page.
At the same time that the numbers are being written can't you keep a running total?
if you are using SQL, you can use the "sum" function in the SQL..
something like:
set rowcount 0 select sum(thenumbers) as theSum from table
this will return you a field that will hold the sum of the numbers, so practically you can have 2 SQL's one to grab the numbers, and another for the summing, or you can combine them in one SQL that will return you both.