JavaScript Is Not Working
Solution 1:
classnm
is never set to anything other than 0...
Solution 2:
class is a javascript reserved word, rename all "class" to something else. E.g. "myClass"
Renaming "class" should make your code work, but I still see many minimal errors in your code like unclosed "head" tag, use of uninitialized variable, etc. Suggest you review it thoroughly.
Solution 3:
I ran your code in Firefox with the Firebug extension installed. It reported the following error.
class[classCtr] is undefined on Line 34
Line 34 is the following:
totalvalue = totalvalue + parseFloat(class[classCtr][2]);
This error is occurring because you increment classCtr
on the previous line, so the call to class[classCtr]
attempts to access something that hasn't yet been defined.
Also, classCtr
isn't assigned an initial value, so will have the value unassigned
. The first set of values will therefore be stored in classCtr[undefined]
.
You'll need to initialize classCtr
when it is declared and then increment it after you've finished handling each class.
Post a Comment for "JavaScript Is Not Working"