Let me start by saying that I really have no knowledge or experience in Javascript. I'm not the individual at my company who's in charge of maintaining the website, but I was brought it on this issue and am trying to find a solution.
We have some simple javascript on a page to generate a total for bus pass purchases (it can be seen here:
In Firefox and Safari, the total box works perfectly, however in IE, it displays "NaN." I've done some research on the issue and believe the problem is similar to what was going on here:
However, since I really have no knowledge of Javascript, I'm unable to fix it. Would someone be able to explain what changes I need to correct the issue? I've pasted the relevant code below, though if one wants to see the full source of the page, they can do so by going to the link above.
Thanks in advance for the assistance!
We have some simple javascript on a page to generate a total for bus pass purchases (it can be seen here:
In Firefox and Safari, the total box works perfectly, however in IE, it displays "NaN." I've done some research on the issue and believe the problem is similar to what was going on here:
However, since I really have no knowledge of Javascript, I'm unable to fix it. Would someone be able to explain what changes I need to correct the issue? I've pasted the relevant code below, though if one wants to see the full source of the page, they can do so by going to the link above.
Thanks in advance for the assistance!
Code:
<script language="javascript">
function updateSum(updated)
{
var a10, aMon, s10, sMon, y10, yMon, l10, lMon, ll10, llMon, total, grandTotal, sum;
a10 = parseInt(document.getElementById("Addult 10-ride").value);
aMon = parseInt(document.getElementById("Addult Monthly").value);
s10 = parseInt(document.getElementById("Senior 10-ride").value);
sMon = parseInt(document.getElementById("Senior Monthly").value);
y10 = parseInt(document.getElementById("Youth 10-Ride").value);
yMon = parseInt(document.getElementById("Youth Montly").value);
l10 = parseInt(document.getElementById("LINK 10-Ride").value);
lMon = parseInt(document.getElementById("LINK Monthly").value);
ll10 = parseInt(document.getElementById("Link Local 10").value)
llMon = parseInt(document.getElementById("Link Local Monthly").value)
total = document.getElementById("total");
grandTotal = document.getElementById("grand total");
sum = a10+ aMon + s10 + sMon + y10 + yMon + l10 + lMon + ll10 + llMon;
if (sum > 5) {
updated.value = 0;
window.alert("Sorry, only five bus passes can be purchased at a time");
updateSum();
}
else {
total.value = sum;
grandTotal.value = a10*10 + aMon*42 + s10*5 + sMon*21 + y10*5 + yMon*21 + l10*40 + lMon*125 + ll10*30 + llMon*99 + 1;
}
}
</script>