johfarrar
12-17-2002, 08:55 PM
I need a way to convert input into a number. I have a function that doesn't work. Please help.
function totalPoints() {
var points = 0;
for (i=1; 8 >= i; i++) {
var x = document.forms[i].grade.value;
if ((x == "a") || (x == "A")) {
eval(points + 4);
}
else {
if ((x == "b") || (x == "B")) {
eval(points + 3);
}
else {
if ((x == "c") || (x == "C")) {
eval(points + 2);
}
else {
if ((x == "d") || (x == "D")) {
eval(points + 1);
}
else {
if ((x == "f") || (x == "F")) {
eval(points + 0);
}
}
}
}
}
}
return points;
}
function totalPoints() {
var points = 0;
for (i=1; 8 >= i; i++) {
var x = document.forms[i].grade.value;
if ((x == "a") || (x == "A")) {
eval(points + 4);
}
else {
if ((x == "b") || (x == "B")) {
eval(points + 3);
}
else {
if ((x == "c") || (x == "C")) {
eval(points + 2);
}
else {
if ((x == "d") || (x == "D")) {
eval(points + 1);
}
else {
if ((x == "f") || (x == "F")) {
eval(points + 0);
}
}
}
}
}
}
return points;
}