Thanks to everyone who replied to this post. I've updated the page on
my blog to reflect my current status regarding this issue (http://
techqi.blogspot.com/2008/02/beta.html).
Anyway, I'm lost and I'm no expert. Never used Firebug etc. I'm
pasting the code below, works fine on my system:
--------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Grade Calculator</title>
<style type="text/css">
<!--
..style1 {font-size: x-small}
..style2 {
color: #FF0000;
font-weight: bold;
}
-->
</style>
</head>
<body>
<form name="gradeform">
<table width="424">
<tr>
<td width="279"><strong>Enter your scores below: </strong></td>
<td width="60"> </td>
<td width="69" valign="bottom"><div align="center"><span
class="style1">include?</span></div></td>
</tr>
<tr>
<td>1st in-class essay on Simple Recipes (15%):</td>
<td><input type="text" name="inclass1" size="10" maxlength="10" >
</td>
<td><div align="right">
<select name="sel1" id="sel1">
<option selected>no</option>
<option>yes</option>
</select>
</div></td>
</tr>
<tr>
<td>At-home essay on Olympia or Othello (25%):</td>
<td><input type="text" name="athome" size="10" maxlength="10">
</td>
<td><div align="right">
<select name="sel2" id="sel2">
<option selected>no</option>
<option>yes</option>
</select>
</div></td>
</tr>
<tr>
<td>2nd in-class essay on Poetry (20%):</td>
<td><input type="text" name="inclass2" size="10" maxlength="10">
</td>
<td><div align="right">
<select name="sel3" id="sel3">
<option selected>no</option>
<option>yes</option>
</select>
</div></td>
</tr>
<tr>
<td>Final exam (30%) : </td>
<td><input type="text" name="final" size="10" maxlength="10"></td>
<td><div align="right">
<select name="sel4" id="sel4">
<option selected>no</option>
<option>yes</option>
</select>
</div></td>
</tr>
<tr>
<td>Participation (10%) : </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="3"><table width="411" align="center">
<tr>
<td width="297">How many quizzes did you take? </td>
<td width="102"><select name="quiztaken" onChange="quizSel()">
<option selected>select</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select></td>
</tr>
<tr>
<td>Out of how many? </td>
<td><select name="totalquiz">
<option selected>select</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select></td>
</tr>
<tr>
<td><table width="211" align="center">
<tr>
<td width="203" colspan="3">
<div name="q" id="q" style="margin-bottom:4px;
display:none;"><strong>Enter your quiz scores below:</strong></div>
<div name="q1" id="q1"style="margin-bottom:2px; display:none;">
#1:
<span style="padding-left:4px; padding-right:4px;">
<input type="text" name="quiz1" size="8" maxlength="8">
</span>out of 5
</div>
<div name="q2" id="q2" style="margin-bottom:2px; display:none ">
#2:
<span style="padding-left:4px; padding-right:4px;">
<input type="text" name="quiz2" size="8" maxlength="8">
</span>out of 5
</div>
<div name="q3" id="q3" style="margin-bottom:2px; display:none ">
#3:
<span style="padding-left:4px; padding-right:4px;">
<input type="text" name="quiz3" size="8" maxlength="8">
</span>out of 5
</div>
<div name="q4" id="q4" style="margin-bottom:2px; display:none ">
#4:
<span style="padding-left:4px; padding-right:4px;">
<input type="text" name="quiz4" size="8" maxlength="8">
</span>out of 5
</div>
<div name="q5" id="q5" style="margin-bottom:2px; display:none ">
#5:
<span style="padding-left:4px; padding-right:4px;">
<input type="text" name="quiz5" size="8" maxlength="8">
</span>out of 5
</div>
</td>
</tr>
</table></td>
<td> </td>
</tr>
<tr>
<td>How many Friday seminars have you missed? <a
href="javascript
opup1()">help</a></td>
<td><select name="semmissed">
<option selected>select</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
</select></td>
</tr>
<tr>
<td>Out of how many? <br>
<a href="javascript
opup1()">help</a> </td>
<td><select name="totalsem">
<option selected>select</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
</select></td>
</tr>
</table></td>
</tr>
<tr>
<td height="35" colspan="3"><input value="Calculate Grade"
onclick="gradeCalc()" type="button"/>
<input value="Reset form"
onclick="javascript:document.gradeform.reset();history.go(0);return
false" type="button"/></td>
</tr>
<tr valign="middle">
<td height="35" colspan="3"> <span class="style2"> Note:
</span><br>
This is only an approximation. Scroll down for your grade
projection. </td>
</tr>
<tr>
<td height="35" colspan="3"><strong>Your grade projection: </
strong></td>
</tr>
<tr>
<td>Total score: </td>
<td><input name="score" type="text" id="score" size="10"
maxlength="10" style="font-weight:bold; color:#FF0000" readonly></td>
<td> </td>
</tr>
<tr>
<td height="25">Out of total marks: </td>
<td><input name="total" type="text" id="total" size="10"
maxlength="10" style="font-weight:bold; color:#FF0000" readonly></td>
<td> </td>
</tr>
<tr>
<td>You're currently on:</td>
<td><input name="grade" type="text" id="grade" size="10"
maxlength="10" style="font-weight:bold; color:#FF0000" readonly></td>
<td> </td>
</tr>
<tr>
<td>Your current percentile score: </td>
<td><input name="perc" type="text" id="perc" size="10"
maxlength="10" style="font-weight:bold; color:#FF0000" readonly></td>
<td> </td>
</tr>
<tr>
<td colspan="3"><br>
<span class="style2"> Note: </span><br>
Click 'Reset Form' if you're having problems, and try again.
<br>
If you're still bugged drop a comment. </td>
</tr>
</table>
</form>
<script language="javascript1.4" type="text/javascript">
function gradeCalc() {
var sum = 0;
var whole = 0;
var xperc = 0;
var xgrade = 0;
sel1 = document.gradeform.sel1.value;
if (sel1 == "yes") {
inclass1 = document.gradeform.inclass1.value;
onSubmit(inclass1, "1st in-class essay");
inclass1 = parseFloat(inclass1);
if ((inclass1<0) || (inclass1>15)) throw(alert("Error: range
exceeded for 1st in-class essay"));
sum = sum + inclass1;
whole = whole + 15;
}
else document.gradeform.inclass1.value = "";
sel2 = document.gradeform.sel2.value;
if (sel2 == "yes") {
athome = document.gradeform.athome.value;
onSubmit(athome, "at-home essay");
athome = parseFloat(athome);
if ((athome<0) || (athome>25)) throw(alert("Error: range exceeded
for at-home essay"));
sum = sum + athome;
whole = whole + 25;
}
else document.gradeform.athome.value = "";
sel3 = document.gradeform.sel3.value;
if (sel3 == "yes") {
inclass2 = document.gradeform.inclass2.value;
onSubmit(inclass2, "2nd in-class essay");
inclass2 = parseFloat(inclass2);
if ((inclass2<0) || (inclass2>20)) throw(alert("Error: range
exceeded for 2nd in-class essay"));
sum = sum + inclass2;
whole = whole + 20;
}
else document.gradeform.inclass2.value = "";
sel4 = document.gradeform.sel4.value;
if (sel4 == "yes") {
final = document.gradeform.final.value;
onSubmit(final, "final exam");
final = parseFloat(final);
if ((final<0) || (final>30)) throw(alert("Error: range exceeded for
final exam"));
sum = sum + final;
whole = whole + 30;
}
else document.gradeform.final.value = "";
quiztaken = document.gradeform.quiztaken.value;
totalquiz = document.gradeform.totalquiz.value;
if (((quiztaken == "select") & !(totalquiz =="select"))|(!(quiztaken
== "select") & (totalquiz =="select")))
throw(alert("Error: illegal selection for quiz"));
if (!(quiztaken == "select") & !(totalquiz =="select")) {
if (quiztaken > totalquiz)
throw(alert("Error: illegal selection for quiz"));
}
if (quiztaken >= 1) {
quiztaken = parseInt(quiztaken);
totalquiz = parseInt(totalquiz);
whole = whole + totalquiz;
quiz1 = document.gradeform.quiz1.value;
onSubmit(quiz1, "quiz #1");
if ((quiz1<0) || (quiz1>5)) throw(alert("Error: range exceeded for
quiz #1"));
quiz1 = parseFloat(quiz1);
sum = sum + (quiz1/5);
if (quiztaken >= 2) {
quiz2 = document.gradeform.quiz2.value;
onSubmit(quiz2, "quiz #2");
if ((quiz2<0) || (quiz2>5)) throw(alert("Error: range exceeded for
quiz #2"));
quiz2 = parseFloat(quiz1);
sum = sum + (quiz2/5);
if (quiztaken >= 3) {
quiz3 = document.gradeform.quiz3.value;
onSubmit(quiz3, "quiz #3");
if ((quiz3<0) || (quiz3>5)) throw(alert("Error: range exceeded for
quiz #3"));
quiz3 = parseFloat(quiz3);
sum = sum + quiz3/5;
if (quiztaken >=4) {
quiz4 = document.gradeform.quiz4.value;
onSubmit(quiz4, "quiz #4");
if ((quiz4<0) || (quiz4>5)) throw(alert("Error: range exceeded
for quiz #4"));
quiz4 = parseFloat(quiz4);
sum = sum + quiz4/5;
if (quiztaken == 5) {
quiz5 = document.gradeform.quiz5.value;
onSubmit(quiz5, "quiz #5");
if ((quiz5<0) || (quiz5>5)) throw(alert("Error: range exceeded
for quiz #5"));
quiz5 = parseFloat(quiz5);
sum = sum + quiz5/5;
}
}
}
}
}
semmissed = document.gradeform.semmissed.value;
totalsem = document.gradeform.totalsem.value;
if (((semmissed == "select") & !(totalsem =="select"))|(!(semmissed
== "select") & (totalsem =="select")))
throw(alert("Error: illegal selection for seminars missed"));
if (!(semmissed == "select") & !(totalsem =="select")) {
if (semmissed > totalsem)
throw(alert("Error: illegal selection for seminars missed"));
}
if ((semmissed != "select") & (totalsem !="select")) {
semmissed = parseInt(semmissed);
totalsem = parseInt(totalsem);
semmissed = semmissed*(0.5);
totalsem = totalsem*(0.5)
sum = sum + (totalsem-semmissed);
whole = whole + totalsem;
}
xperc = sum/whole * 100;
if ((xperc>89) && (xperc<=100)) xgrade ='A+';
else if((xperc>84) && (xperc<=89)) xgrade ='A';
else if((xperc>79) && (xperc<=84)) xgrade ='A-';
else if((xperc>75) && (xperc<=79)) xgrade ='B+';
else if((xperc>71) && (xperc<=75)) xgrade ='B';
else if((xperc>67) && (xperc<=71)) xgrade ='B-';
else if((xperc>63) && (xperc<=67)) xgrade ='C+';
else if((xperc>59) && (xperc<=63)) xgrade ='C';
else if((xperc>54) && (xperc<=59)) xgrade ='C-';
else if((xperc>49) && (xperc<=54)) xgrade ='D';
else if((xperc>=0) && (xperc<=49)) xgrade ='F';
else throw(alert("Error: invalid data"));
xperc = Math.round(xperc*Math.pow(10,3))/Math.pow(10,3);
document.gradeform.score.value = sum;
document.gradeform.total.value = whole;
document.gradeform.grade.value = xgrade;
document.gradeform.perc.value = xperc+"%";
}
function onSubmit(value, id) {
this.value = value;
this.id = id;
if (isNaN(value) || (value == "")) {
throw(alert("Error: invalid entry for \""+id+"\", only numerical
score allowed"));
}
}
function quizSel() {
quiztaken = document.gradeform.quiztaken.value;
if (quiztaken == 1) {
document.getElementById("q").style.display = "block";
document.getElementById("q1").style.display = "block";
document.getElementById("q2").style.display = "none";
document.gradeform.quiz2.value = "";
document.getElementById("q3").style.display = "none";
document.gradeform.quiz3.value = "";
document.getElementById("q4").style.display = "none";
document.gradeform.quiz4.value = "";
document.getElementById("q5").style.display = "none";
document.gradeform.quiz5.value = "";
return;
}
if (quiztaken == 2) {
document.getElementById("q").style.display = "block";
document.getElementById("q1").style.display = "block";
document.getElementById("q2").style.display = "block";
document.getElementById("q3").style.display = "none";
document.gradeform.quiz3.value = "";
document.getElementById("q4").style.display = "none";
document.gradeform.quiz4.value = "";
document.getElementById("q5").style.display = "none";
document.gradeform.quiz5.value = "";
return;
}
if (quiztaken == 3) {
document.getElementById("q").style.display = "block";
document.getElementById("q1").style.display = "block";
document.getElementById("q2").style.display = "block";
document.getElementById("q3").style.display = "block";
document.getElementById("q4").style.display = "none";
document.gradeform.quiz4.value = "";
document.getElementById("q5").style.display = "none";
document.gradeform.quiz5.value = "";
return;
}
if (quiztaken == 4) {
document.getElementById("q").style.display = "block";
document.getElementById("q1").style.display = "block";
document.getElementById("q2").style.display = "block";
document.getElementById("q3").style.display = "block";
document.getElementById("q4").style.display = "block";
document.getElementById("q5").style.display = "none";
document.gradeform.quiz5.value = "";
return;
}
if (quiztaken == 5) {
document.getElementById("q").style.display = "block";
document.getElementById("q1").style.display = "block";
document.getElementById("q2").style.display = "block";
document.getElementById("q3").style.display = "block";
document.getElementById("q4").style.display = "block";
document.getElementById("q5").style.display = "block";
return;
}
document.getElementById("q").style.display = "none";
document.getElementById("q1").style.display = "none";
document.gradeform.quiz1.value = "";
document.getElementById("q2").style.display = "none";
document.gradeform.quiz2.value = "";
document.getElementById("q3").style.display = "none";
document.gradeform.quiz3.value = "";
document.getElementById("q4").style.display = "none";
document.gradeform.quiz4.value = "";
document.getElementById("q5").style.display = "none";
document.gradeform.quiz5.value = "";
return;
}
function popup1() {
popup1 = window.open("", "popup1", "status = 1, left = 300, top =
200, width = 450, height = 250, scrollbars = 1");
popup1.document.write("<html><head><title>Seminar dates</title></
head>");
popup1.document.write("<body><b><u>Seminar dates for ENGL 110.005,
Winter 2 term, 2008:</b></u><br/><br/>");
popup1.document.write("Fri, Jan. 11: Discussion group on Simple
Recipes (1-53)<br/>");
popup1.document.write("Fri, Jan. 18: Discussion group on Simple
Recipes (55-125)<br/><br/>");
popup1.document.write("Fri, Feb. 01: Discussion group on Olympia
(1-122)<br/>");
popup1.document.write("Fri, Feb. 08: Discussion group on Olympia
(123-195) said:
popup1.document.write("Fri, Feb. 29: Discussion Group on Othello<br/
popup1.document.write("Fri, Mar. 07: Discussion group on Mom, Dad,
I'm Living With a White Girl<br/>");
popup1.document.write("Fri, Mar. 14: Discussion group on Ondaatje
and Gill<br/><br/>");
popup1.document.write("Fri, Apr. 04: Discussion group on Diamond
Grill<br/>");
popup1.document.write("Fri, Apr. 11: Last day of classes; last
discussion group</body></html>");
popup1.document.close();
}
</script>
<p> </p>
</body>
</html>