havey
04-28-2003, 04:07 PM
I have some radio buttons in a form with the following names, e1,e2,e3,f1,f2, the user can select their langauage ability in both languages, however, i need only the summed value highest scoring language set (either english or french).
to simplify things it would look like this:
English---read---write---speak
excellent-e1-----e2------e3
well-------e1-----e2------e3
poor------e1-----e2------e3
French-----read-----write-----speak
excellent----f1-------f2--------f3
well----------f1-------f2--------f3
poor---------f1-------f2--------f3
So i'm basically trying to add up the English values and then the French and see if the english selections are greateer than the french or vice versa, then i'm transposing this larger language set to a variable (lan)
The following only comes up with lan = 0, its like the code has the correct syntax but the radio values are not being used to calculate the if then statement at the end, why does a1 & a2 variable have no value and var lan always = 0?
function Process () {
var itemchecked = false;
var a1 = a2 = lan = 0;
fr1 = document.f8;
x=1;
while(eval("fr1.e"+x)){
if(eval("fr1.e"+x+".checked")){
a1+=parseInt(eval("fr1.e"+x+".value"));
}
x++;
}
fr2 = document.f8;
y=1;
while(eval("fr2.f"+y)){
if(eval("fr2.f"+y+".checked")){
a2+=parseInt(eval("fr2.f"+y+".value"));
}
y++;
}
if (a1 > a2) {
lan = a1;
}else{
if (a2 > a1) {
lan = a2;
}else{
if (a2 = a1) {
lan = a1;
}
}
}
}
to simplify things it would look like this:
English---read---write---speak
excellent-e1-----e2------e3
well-------e1-----e2------e3
poor------e1-----e2------e3
French-----read-----write-----speak
excellent----f1-------f2--------f3
well----------f1-------f2--------f3
poor---------f1-------f2--------f3
So i'm basically trying to add up the English values and then the French and see if the english selections are greateer than the french or vice versa, then i'm transposing this larger language set to a variable (lan)
The following only comes up with lan = 0, its like the code has the correct syntax but the radio values are not being used to calculate the if then statement at the end, why does a1 & a2 variable have no value and var lan always = 0?
function Process () {
var itemchecked = false;
var a1 = a2 = lan = 0;
fr1 = document.f8;
x=1;
while(eval("fr1.e"+x)){
if(eval("fr1.e"+x+".checked")){
a1+=parseInt(eval("fr1.e"+x+".value"));
}
x++;
}
fr2 = document.f8;
y=1;
while(eval("fr2.f"+y)){
if(eval("fr2.f"+y+".checked")){
a2+=parseInt(eval("fr2.f"+y+".value"));
}
y++;
}
if (a1 > a2) {
lan = a1;
}else{
if (a2 > a1) {
lan = a2;
}else{
if (a2 = a1) {
lan = a1;
}
}
}
}