++ is the increment operator.  

-----Original Message-----
From: Craig Dudley [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 28, 2001 10:27 AM
To: CF-Talk
Subject: RE: javascript add problem


+ is for concatenating strings (spelling?)

++ will add them up i think.

-----Original Message-----
From: Bernd VanSkiver [mailto:[EMAIL PROTECTED]]
Sent: 28 March 2001 17:13
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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to