I have been trying to get this code to work, it is suppose to alert me of the letter grade I received, I have looked everywhere for help and I feel that I am just overlooking something. Please tell me what I am doing wrong.
<!DOCTYPE html>
<HTML>
<HEAD>
<TITLE>Javascript Grade Calculator</TITLE>
<body style="background-color: yellow">
<H1> <style=" color: black; font-family: Times New Roman" align="center"><u>Grade Calculator</u> </H1>
<h2>Directions: To use this calculator just enter your points for each item in the input boxes, then press the "Calculate" button to see your total points.</h2>
<h3> </h3>
<SCRIPT LANGUAGE="JavaScript">
function do_addition()
{
var lab1 = parseFloat(document.form1.Lab1Score.value);
var lab2 = parseFloat(document.form2.Lab2Score.value);
var lab3 = parseFloat(document.form3.Lab3Score.value);
var lab4 = parseFloat(document.form4.Lab4Score.value);
var lab5 = parseFloat(document.form5.Lab5Score.value);
var lab6 = parseFloat(document.form6.Lab6Score.value);
var test1 = parseFloat(document.form7.Test1Score.value);
var test2 = parseFloat(document.form8.Test2Score.value);
var test3 = parseFloat(document.form9.Test3Score.value);
var cp = parseFloat(document.form10.ClassScore.value);
var sum = (lab1 + lab2 + lab3 + lab4 + lab5 + lab6 + test1 + test2 + test3 + cp);
alert("The value of Lab 1 is "+lab1+" so I got to the function");
alert("The value of Lab 2 is "+lab2+" so I got to the function");
alert("The value of Lab 3 is "+lab3+" so I got to the function");
alert("The value of Lab 4 is "+lab4+" so I got to the function");
alert("The value of Lab 5 is "+lab5+" so I got to the function");
alert("The value of Lab 6 is "+lab6+" so I got to the function");
alert("The value of Test 1 is "+test1+" so I got to the function");
alert("The value of Test 2 is "+test2+" so I got to the function");
alert("The value of Final is "+test3+" so I got to the function");
alert("The value of Class Score is "+cp+" so I got to the function");
document.sum.value = result;
}
if (result >= 405 && result <= 450) {alert("Total Points of "+result+" gives you an A");}
else if (result >= 360 && result <= 404) {alert("Total Points of "+result+" gives you an B");}
else if (result >= 292 && result <= 359) {alert("Total Points of "+result+" gives you an C");}
else if (result >= 247 && result <= 291) {alert("Total Points of "+result+" gives you an D");}
else if (result >= 0 && result <= 246) {alert("Total Points of "+result+" gives you an F");}
function getTime()
{
var now = new Date();
var h = now.getHours();
var m = now.getMinutes();
var s = now.getSeconds();
m = checkTime(m);
s = checkTime(s);
document.getElementById("clock").innerHTML = h + ":" + m + ":" + s;
setTimeout("getTime()", 1000);
}
function checkTime(time)
{
if(time<10)
{
time = "0" + time;
}
return time;
}
</SCRIPT>
</HEAD>
</TITLE>
<BODY onload="getTime();">
<form name="form1">
Lab #1(10 points):
<input type="text" name="Lab1Score" size="5"><br> </form>
<form name="form2">
Lab #2(10 points):
<input type="text" name="Lab2Score" size="5"><br> </form>
<form name="form3">
Lab #3(10 points):
<input type="text" name="Lab3Score" size="5"><br> </form>
<form name="form4">
Lab #4(20 points):
<input type="text" name="Lab4Score" size="5"><br> </form>
<form name="form5">
Lab #5(20 points):
<input type="text" name="Lab5Score" size="5"><br> </form>
<form name="form6">
Lab #6(30 points):
<input type="text" name="Lab6Score" size="5"><br> </form>
<form name="form7">
Test #1(100 points):
<input type="text" name="Test1Score" size="5"><br> </form>
<form name="form8">
Test #2(100 points):
<input type="text" name="Test2Score" size="5"><br> </form>
<form name="form9">
Test #3(100 points):
<input type="text" name="Test3Score" size="5"><br> </form>
<form name="form10">
Class participation(50 points):
<input type="text" name="ClassScore" size="5"><br> </form>
<input type="button" value="Calculate your score" name="add" onClick="do_addition()"><br> </form>
<p>
<form name="form11">
Total Points(450 points):
<input type="text" name="Total" size="6"><br> </form>
<input type=reset value=Reset><br> </form>
<p>The current time is: </p>
<p id='clock'></p>
</BODY>
</HTML>
please compare your code with mine.i have fixed your first section which is calculating score in test and lab.please do the same for time based test.