I'm not a javascript guy, so I'm using my brothers name on here cause he said you all were the best, and could help me...
A dropdown box calls this routine...
Code: Select all
<SCRIPT LANGUAGE="JavaScript">
function adCalc(form) {
var cost = eval(form.type.value);
var sublength = eval(form.subs.value);
var newprice = cost + sublength;
document.getElementById("price").innerHTML = newprice;
}
</SCRIPT>It's supposed to take the cost, which is 0, $29.99, or $39.99, then add sublength, which is either 0 or 10 to it...
The cost works fine, but when I add teh sublength I get ...
39.989999999999995
instead of 49.99.
What's going on here?
Thanks