GetDotted Domains

Viewing Thread:
"little Javascript help?"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Tue 26/10/04 at 17:26
Regular
"Picking a winner!"
Posts: 8,502
Havn't looked at much javascript lately, been nearly a year since I've last used it but I think I may need it for a small thing I want to do.

I have a smallish table with a few columns, the last being costs, would like to write a little script to add up the costs, work out the total and the average cost.

Just a bit confused as to how I get the value in each of the end columns to add up?

Anyone give me some pointers?
Cheers
Tue 26/10/04 at 17:26
Regular
"Picking a winner!"
Posts: 8,502
Havn't looked at much javascript lately, been nearly a year since I've last used it but I think I may need it for a small thing I want to do.

I have a smallish table with a few columns, the last being costs, would like to write a little script to add up the costs, work out the total and the average cost.

Just a bit confused as to how I get the value in each of the end columns to add up?

Anyone give me some pointers?
Cheers
Tue 26/10/04 at 18:21
"bdp(big_dude_paul)"
Posts: 178
can't you use excel?
Tue 26/10/04 at 19:19
Regular
"Picking a winner!"
Posts: 8,502
Nah, its a webbased table from my website.
Tue 26/10/04 at 22:57
Regular
"It goes so quickly"
Posts: 4,083
I would place each value in an array and have JavaScript simply print out each value in the required column using a loop, then add up the total at the end and print that out as well.
Wed 27/10/04 at 11:56
Regular
"Picking a winner!"
Posts: 8,502
cjh wrote:
> I would place each value in an array and have JavaScript simply print
> out each value in the required column using a loop, then add up the
> total at the end and print that out as well.

The table is already created, don't really fancy changing it as I'd need to use the script again on a much larger table which is already created...

I've a rough idea how to go about it but have no idea how to access the numerical data in the last column of each row.. this seems to be the bit thats causing me the most problems at the moment..
Wed 27/10/04 at 12:02
Regular
"Pouch Ape"
Posts: 14,499
You'd have to do it on the fly, wouldn't you: use document.write(), or similar method. Unless it's input boxes, then simply use 'myvariable = myvariable + document.myform.mytextbox_a.value' etc.
Thu 28/10/04 at 16:40
Regular
"Picking a winner!"
Posts: 8,502
Well I kinda worked out the wa to do it, looking through the DOM for the HTML and javascript but its rather messy, not liking this much at all.

Think I'll just leave it and concentrate on something better.

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Great services and friendly support
I have been a subscriber to your service for more than 9 yrs. I have got at least 12 other people to sign up to Freeola. This is due to the great services offered and the responsive friendly support.
Many thanks!
You were 100% right - great support!

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.