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 Web Applications With ColdFusion MX7 & Flex 2. Build powerful, scalable RIAs. Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:283880 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

