Simple Javascript Math Error
by "Hooloovoo" <hwg(at)hooloovoo.com>
|
| Date: |
Mon, 17 Sep 2001 16:15:12 -0400 |
| To: |
hwg-techniques(at)hwg.org |
| |
todo: View
Thread,
Original
|
|
OK I've got what I know will turn out to be something small that I'm
overlooking but it's driving me nuts.
I've recently been learning Javascript so I thought I'd make a nice
*simple* order form for the calendars I do for one of my mailing
lists. It's basic: http://www.hooloovoo.com/todd/calendar2.html
And of course I thought everything was working and I tested it with
random number. Well today I went and put in the correct shipping
info and there's where I hit the first problem. For some reason only
when ordering 1 calendar and entering the shipping of 4.35 it gives
me a run-on decimal.
The script is supposed to just take the calendar price ($24.88)
multiply it by the number of calendars ordered and then add
shipping. Since calendars are only ordered in round numbers and
shipping is only 2 decimals, there should never be more than 2
decimal places and I'm stumped as to why it's giving me a
$29.2299 instead of $29.23.
Can someone please solve this mystery?
your novice Javascripter
-Hoo
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA
This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.