Thanks Barney... That did the trick. -----Original Message----- From: Barney Boisvert [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 17, 2007 11:46 AM To: CF-Talk Subject: Re: Simple JS math?
num + eval(frac) The latter operand will evaluate the string as if it were javascript (i.e. do 3 / 8), which will give you the floating-point equivalent of the fraction, which can then be added to the integer (giving 20.375). cheers, barneyb On 7/17/07, Che Vilnonis <[EMAIL PROTECTED]> wrote: > Looking to add an integer and a fraction. How do I do this with Javascript? > Thanks, Che! > > <script language="JavaScript"> > var num = 20; > var frac = "3/8"; > var DBWTemp = (num + frac); > document.write(DBWTemp); > </script> > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:283895 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4