[Javascript] Calculating large number of different values
Fred Newtz
fbnewtz at newtz.us
Wed Aug 3 18:03:31 CDT 2005
Alright, I have typed this email twice and have finally decided to just
break it down to its simplest form:
I have a two dimensional array that represents the # of days in a week in
the first dimension and the total number of kids in an age group in the
second dimension.
So
PlanPart[0][0] = [Sunday][1-2 year olds total attendance]
PlanPart[1][0] = [Monday][1-2 year olds total attendance]
Planpart[0][1] = [Sunday][3-5 year olds total attendance]
PlanPart[0][2] = [Sunday][6-12 year olds total attendace]
Etc...
>From there I have three different One Dimensional arrays (could possible be
a two dimensional array instead obviously) that contains the different
quantites served for each different age group.
So
milk_array[0] = Amount of milk served for 1-2 year olds
Milk_array[1] = Amount of milk served for 3-5 year olds
Milk_array[2] = Amount of milk servedfor 6-12 year olds
Grain_array[0-2] = Amount of Grains Served for each age group
Fruit_array[0-2] = Amount of fruit served for each age group
Now I need to be able to update nine different text boxes with the total
quantities served of each different category of food * number of children in
each age group for that particular day of the week.
So what is the best way to name my textboxes and setup my arrays so that I
can loop through them easily, make the calculation and assign it to the
textbox's value.
How can I do this when my page loads. There is a set of drop down boxes on
the page for the current date. I want the totals to be shown for the
current day of the week when the page is loaded.
How can I trigger the totals to change when someone manually types in the
total # of children for a specific age group? What event should I use and
do I have to calculate all of the values on the page again or do I have to
write four different functions to make this all happens properly? Or just
one function that has a optional parameter that just tells the function to
calculate a specific age group?
Argh! I have this basically work, but my code is HUGE! I have three
different forms I have to do calculations on and my total code length is in
excess of 100k. Needless to say it does not load properly and I have to do
something better.
Thanks for the help in advance! Hopefully people understand what I am
asking!
Thanks,
Fred Newtz
Thanks,
Fred Newtz
More information about the Javascript
mailing list