Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #15585
| From | Dr J R Stockton <reply1234@merlyn.demon.co.uk.invalid> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Sum of several fields using parseInt differs from that of using a calculator |
| Date | 2012-08-26 18:54 +0100 |
| Organization | Home |
| Message-ID | <yGfDINJ+KmOQFwsE@invalid.uk.co.demon.merlyn.invalid> (permalink) |
| References | <24572a83-a8c2-4e00-99b2-383206781c09@d13g2000yqm.googlegroups.com> <5038d580$0$6633$9b4e6d93@newsspool2.arcor-online.net> |
In comp.lang.javascript message <5038d580$0$6633$9b4e6d93@newsspool2.arc
or-online.net>, Sat, 25 Aug 2012 15:39:12, Martin Honnen
<mahotrash@yahoo.de> posted:
>Use parseFloat(field.value) if there can be floating point numbers like
>1015.75 input in the field.
I prefer something more like
var NameOfField1 = + field1.value
var NameOfField2 = + field2.value
// ...
Total = NameOfField1 + NameOfField2
assuming that the fields contain only the number and maybe leading &
trailing whitespace.
--
(c) John Stockton, nr London UK Reply address via Home Page.
news:comp.lang.javascript FAQ <http://www.jibbering.com/faq/index.html>.
<http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Sum of several fields using parseInt differs from that of using a calculator justaguy <lichunshen84@gmail.com> - 2012-08-25 06:18 -0700
Re: Sum of several fields using parseInt differs from that of using a calculator Martin Honnen <mahotrash@yahoo.de> - 2012-08-25 15:39 +0200
Re: Sum of several fields using parseInt differs from that of using a calculator justaguy <lichunshen84@gmail.com> - 2012-08-25 09:27 -0700
Re: Sum of several fields using parseInt differs from that of using a calculator Denis McMahon <denismfmcmahon@gmail.com> - 2012-08-25 18:53 +0000
Re: Sum of several fields using parseInt differs from that of using a calculator SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-08-26 11:13 +0200
Re: Sum of several fields using parseInt differs from that of using a calculator Dr J R Stockton <reply1234@merlyn.demon.co.uk.invalid> - 2012-08-26 18:54 +0100
Re: Sum of several fields using parseInt differs from that of using a calculator SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-08-25 20:39 +0200
Re: Sum of several fields using parseInt differs from that of using a calculator justaguy <lichunshen84@gmail.com> - 2012-08-25 14:07 -0700
Re: Sum of several fields using parseInt differs from that of using a calculator Martin Honnen <mahotrash@yahoo.de> - 2012-08-26 11:23 +0200
Re: Sum of several fields using parseInt differs from that of using a calculator SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-08-26 11:27 +0200
Re: Sum of several fields using parseInt differs from that of using a calculator justaguy <lichunshen84@gmail.com> - 2012-08-26 06:26 -0700
Re: Sum of several fields using parseInt differs from that of using a calculator justaguy <lichunshen84@gmail.com> - 2012-08-26 08:48 -0700
Re: Sum of several fields using parseInt differs from that of using a calculator SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-08-26 20:55 +0200
Re: Sum of several fields using parseInt differs from that of using a calculator Denis McMahon <denismfmcmahon@gmail.com> - 2012-08-26 20:50 +0000
Re: Sum of several fields using parseInt differs from that of using a calculator "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-08-26 21:30 +0000
Re: Sum of several fields using parseInt differs from that of using a calculator Denis McMahon <denismfmcmahon@gmail.com> - 2012-08-26 22:29 +0000
Re: Sum of several fields using parseInt differs from that of using a calculator SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-08-26 23:32 +0200
Re: Sum of several fields using parseInt differs from that of using a calculator Denis McMahon <denismfmcmahon@gmail.com> - 2012-08-26 22:39 +0000
Re: Sum of several fields using parseInt differs from that of using a calculator SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-08-27 04:23 +0200
Re: Sum of several fields using parseInt differs from that of using a calculator Martin Leese <please@see.Web.for.e-mail.INVALID> - 2012-08-27 11:09 -0600
Re: Sum of several fields using parseInt differs from that of using a calculator Stefan Weiss <krewecherl@gmail.com> - 2012-08-28 02:14 +0200
Re: Sum of several fields using parseInt differs from that of using a calculator Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-28 14:53 +0200
Re: Sum of several fields using parseInt differs from that of using a calculator Martin Leese <please@see.Web.for.e-mail.INVALID> - 2012-08-28 11:29 -0600
Re: Sum of several fields using parseInt differs from that of using a calculator "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2012-08-25 12:44 -0700
csiph-web