Vote count:
0
I'll be honest, this one is making me frustrated so I thought I really need help. So it's my first question here. Because I don't seem to find my answer. Anyway, here it is.
The code's purpose is simple make it calculate my school grades.
So 4 values are calculated to build up this 100% overall score. this was done three times for Prelim, Midterm, and Finals.. pretty much like how criteria works. But the problem was the Term Grade which was last. it's supposed to take the 3 scores calculated at the bottom an make them a part of another 100%. (We probably all know this)
=========================THE PROBLEM=====================
So I made 3 forms with corresponding functions under 'script' tag. Each for the prelim, midterm and finals. It was all good at that part here's the function for prelim. Everything's the same with the two other functions but the variable names.
And the fourth function which was the one to calculate the first three...
function term()
{
var t1=document.prelim.first.value;
var t2=document.midterm.second.value;
var t3=document.finals.third.value;
var tg=(parseInt(t1)*.30)+(parseInt(t2)*.30)+(parseInt(t3)*.40);
document.getElementById('score').value=tg;
}
And its form:
TERM GRADE:<br>
<form name="term">
<input type="text" name="last" id="score"><br><br>
<input type="button" onclick="term()" value="Get Your Term Grade">
</form>
The problem here is this last one.. I'm pretty sure it works
Been debugging all day and even used those 'online debugging tools'.. what i've got with Free Online HTML Validator is this:
- Discarding Unexpected /center(At line 123, column -3)
- Discarding Unexpected /td (At line 123, column 6)
- Discarding Unexpected /tr(At line 123, column 11)
(sorry, dont know how to make the angle brackets appear)
Also tried F12 in browser(Chrome). says "Uncaught TypeError" It was this part
<input type="button" onclick="term()" value="Get Your Term Grade">
=============================================================
HOW IT IS SUPPOSED TO WORK (optional to read)
Okay so there are three functions with same "function". Calculate my scores for quiz1(20%), quiz2(20%), class standing(10%) and major exam(50%). And their percentages add up to 100&. Each of them has buttons to that will show the result for each period. Why three functions? they are done for Prelim, Midterm and Finals. But the problem was the one which was supposed to take the period grades and add them up (30%, 30%, 40%) to a 100%. Without re-entering the period grades.
THANK YOU FOR ALL OF YOUR HELP COMMUNITY. AND AS ALWAYS, I'M THANKFUL FOR EVERY ANSWER :D
"Uncaught TypeError/Discarding Unexpected" shows up BECAUSE OF ONE LINE? (HTML w/
Aucun commentaire:
Enregistrer un commentaire