You are using grandTotal both as the name of an HTML element and a global Javascript variable. That will cause IE to barf.
Same with
var LHtotal;
var AHtotal;
var LMtotal;
var AMtotal;
But the big problem is
var orgTotal = orgTotal.toFixed(2);
grandTotal = Number(schoolTotal + orgTotal);
.toFixed() converts the numeric value to a string so the following + sign concatenates, not adds the values.
You should use toFixed() only to make a value for display purposes. It cannot be used for any subsequent mathematical calculation.
If you need to retain the value as a number use
Code:
<script type = "text/javascript">
function roundToDigits(number,digits) {
var p = Math.pow(10, digits);
return Math.round(number*p)/p;
}
alert (roundToDigits(123.456789,2));
</script>
Quizmaster: Do you know what 20 per cent of 100 is?
Contestant: 20 per cent of 100 is five per cent