Preserved Topic: trying to add values in a text field |
|
---|---|
Author | Thread |
Nervous Wreck (II) Inmate From: Cincinnati, OH |
posted 02-12-2002 06:04
I'm trying to add values from text fields and put the total in another field. I've tried converting them to integers using parseInt, but no matter what I try, it just does text adds (e.g. 2+2=22 instead of 4). |
Maniac (V) Mad Scientist From: New California |
posted 02-12-2002 06:40
TheDude, |
Nervous Wreck (II) Inmate From: Cincinnati, OH |
posted 02-12-2002 18:34
Thanks! |
Maniac (V) Mad Scientist From: New California |
posted 02-12-2002 19:49 |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 02-12-2002 21:57
Also consider parseFloat if you want to allow decimals. |
Nervous Wreck (II) Inmate From: Cincinnati, OH |
posted 02-14-2002 20:31
Thanks Slime! Turns out, I do have a decimal so I needed to know that function. |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 02-14-2002 21:20
Hmm, if you *really* want to learn JavaScript, well, then get a book - I recommend JavaScript: The Definitive Guide from O'Reilly ( www.oreilly.com ). |
Paranoid (IV) Inmate From: 127.0.0.1 |
posted 02-15-2002 05:30 |