4ever
09-11-2002, 11:02 PM
Hello!
Could someone please look at a form page Iam working on. I am trying
to call a function named "rangeCheck()" to make shure that all the
values entered in all of the 8 textfields are between 1-5. If this is
true I need it to call the function calculate() to add all the text
fields together and put that value into a seperate text field called
"totalpoints". Could someone point me in the right direction, using the
general script I have started with? Here is the link to my
page.http://www.inahq.org/memberladder.html
Here is the part of the script in question....
var range = 0
var n = 0
var i = 0
var total = 0
function rangeCheck()
{
for (n=0; n<9; n++)
{
if (document.forms[0].elements[n].value > 5)
{
window.alert('Please enter a value between 1 and 5 for each points earned category.');
}
else
{
calculate();
}}
function calculate()
{
for (i=1, total=0 ; i<9; i++)
{
total += parsInt(document.forms[0].elements[i].value - 0);
document.memberladder.totalpoints.value = total;
}
}
Could someone please look at a form page Iam working on. I am trying
to call a function named "rangeCheck()" to make shure that all the
values entered in all of the 8 textfields are between 1-5. If this is
true I need it to call the function calculate() to add all the text
fields together and put that value into a seperate text field called
"totalpoints". Could someone point me in the right direction, using the
general script I have started with? Here is the link to my
page.http://www.inahq.org/memberladder.html
Here is the part of the script in question....
var range = 0
var n = 0
var i = 0
var total = 0
function rangeCheck()
{
for (n=0; n<9; n++)
{
if (document.forms[0].elements[n].value > 5)
{
window.alert('Please enter a value between 1 and 5 for each points earned category.');
}
else
{
calculate();
}}
function calculate()
{
for (i=1, total=0 ; i<9; i++)
{
total += parsInt(document.forms[0].elements[i].value - 0);
document.memberladder.totalpoints.value = total;
}
}