|
-
Jan 23rd, 2004, 10:28 AM
#1
Thread Starter
Hyperactive Member
JavaScript: Addding floats & formatting nicely...
I have a form in HTML that has several text boxes where the users enter numbers.
I have a textbox that is to be the sum of those numbers.
I have javascript which parses the values entered by the user to floats, adds them, and displays them in the final text box.
The problem is that if the users enter certain decimal values, I get odd answers.
For example:
Text1 = 10
Text2 = 5
Text3 = 20.52
TotalText = 35.519999999999996
How can I make TotalText show 35.52?
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|