Menu
I have absolutely no idea what’s going on here.
Here’s a function…
[code=html]function addit(n)
{
pr = “price” + n;
qt = “qty” + n;
tt = “tot” + n;
p = document.getElementById(pr).value;
q = document.getElementById(qt).value;
t = p * q;
document.getElementById(tt).value = t;
}
It collects the price and quantity values, multiplies them, and writes them back into a total. Simple enough? I wish!
The price entered was 226.20.
The quantity entered was 3.
The result generated was 678.5999999999999.
Anyone got an explaination?