The parseInt() function works great for it, thanx!

"Hayes, David" <[EMAIL PROTECTED]> wrote:
> The form field values are text, so it's concatenating them.  Try the
> javascript parseInt() function.
> 
> -----Original Message-----
> From: Bernd VanSkiver [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 28, 2001 10:13 AM
> To: CF-Talk
> Subject: OT: javascript add problem
> 
> 
> Sorry about the OT question, but am stumped as to why this won't work.
> Trying
> to use JavaScript to add the numbers in form fields together, instead of
> adding them, it is appending them to each other.  Here is my code:
> 
> <script language="JavaScript">
>       function AddToBasket()
>       {
>               OrderBooks.TotalQty.value = 0
>               OrderBooks.TotalQty.value = eval(OrderBooks.SW.value +
> OrderBooks.SP.value)
>       }
> </script>
> 
> It is taking the value of OrderBooks.SP.value and apending it to
> OrderBooks.SW.value instead of adding them.  For example,
> OrderBooks.SW.value
> = 3 and OrderBooks.SP.value = 5, I am getting 35 instead of 8.  Have tried
> it
> without the eval() in there and have set each form value equal to a
> javascript
> variable also with no change in results.
> 
> Bernd VanSkiver
> [EMAIL PROTECTED]
> ColdFusion Developer
> ICQ #: 916324
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to