Forum Moderators: open

Message Too Old, No Replies

Javascript Help Needed on Maths Problem

         

Maynard

12:00 pm on Sep 15, 2003 (gmt 0)

10+ Year Member



Hello all, I am new to this forum although I have lurked for months, and have found much of the advice very helpful and generous. Now it is my turn to present a problem. How would I do the following in JavaScript:

On the site we present a report card on the company's performance such as: "Customer service is our priority" and then we have a textbox, asking users to enter a percentage score of how well we've done on this. So:

1) User A enters a number percentage (eg 33)
2) This number is added to other users' scores (eg 33 + 45 + 100)
3) An average percentage of all the users' scores is calculated (including the new user A's)
4) This average percentage is returned to user A

My JavaScript level is basic.

Hope you can help.

Cheers, Maynard.

korkus2000

12:04 pm on Sep 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to the board Maynard,

>>This number is added to other users' scores (eg 33 + 45 + 100)

How are you keeping a tally of past percentages? Are you pulling these from a database or text file? This may be something you should do server-side and not with client side script.

Maynard

12:22 pm on Sep 15, 2003 (gmt 0)

10+ Year Member



Hello Korkus!

I guess I would have to keep the tally in a text file. Can this not be done in JavaScript then?

I have some knowledge of PERL. Can this be done in PERL, and if so, HOW?

Any advice would be much appreciated. Thanks so much.

Maynard.

korkus2000

12:25 pm on Sep 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It sounds like you want to keep the data, and client-side javascript is not meant to do this. You could do it in perl, but a scripting language would be much easier. Do you have access to either PHP or ASP on your server?

Maynard

2:29 pm on Sep 15, 2003 (gmt 0)

10+ Year Member



Hi Korkus, we have PERL installed on our server and I understand the basics of this language, having scripted some search engines and worked with PERL and databases. Can you still help me if PERL is used or should I direct this question to another board? Very best, Maynard.

EDIT: I've just realised! I will repost in PERL/CGI forum!

korkus2000

2:33 pm on Sep 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I was going to tell you that the Perl forum would be the best place to ask.