This is actually my school project. I doing a table form and want to loop at Course Marks column and Course Grade Point column. Somehow i'm unable to to figure it out. Need a help to fix my work. Thank in advance.
Script
Code:
<table border="1"> <tr> <th>Course Marks</th> <th>Course Grade Point</th> </tr> <tr> <td><input type="text" id="Mark1" onfocusout="myFunction1()"></td> <td><input type="text" id="Point1" ></td> </tr> <tr> <td> <td><input type="text" id="Mark2" onfocusout="myFunction1()"></td> <td><input type="text" id="Point2" ></td> >
Code:
function myFunction1() {
var gradep=0.0;
var x = document.getElementById("Mark1");
var y = document.getElementById("Point1");
y.value = typeof x.value;
va= Number(y.value);
y.value = typeof va;
x= Number(x.value);
if (x>=80 && x<=100){
gradep=4.00;
}
else if (x>=75 && x<=79){
gradep=3.67;
}
else if (x>=70 && x<=74){
gradep=3.33;
}
else if (x>=65 && x<=69){
gradep=3.00;
}
else if (x>=60 && x<=64){
gradep=2.67;
}
else if (x>=55 && x<=59){
gradep=2.33;
}
else if (x>=50 && x<=54){
gradep=2.00;
}
else if (x>=45 && x<=49){
gradep=1.67;
}
else if (x>=40 && x<=44){
gradep=1.33;
}
else if (x>=35 && x<=39){
gradep=1.00;
}
else if (x>=0 && x<=34){
gradep=0.00;
}
y.value= gradep.toFixed(2);
}