I believe float() will also help with this. Eric
On 3/5/07, Coldfusion <[EMAIL PROTECTED]> wrote: > > Well that is what I was learning about JS. Thanks! The trip in forcing > them > to numbers worked!! > > > -----Original Message----- > From: Peter Boughton [mailto:[EMAIL PROTECTED] > Sent: Monday, March 05, 2007 3:45 AM > To: CF-Talk > Subject: Re: Simple JS? > > JavaScript has an annoying habit of treating numbers as strings. > > "hrRate * OTRate + hrRate" may well be concatenating the values, not > adding > them. > > I usually just divide appropriate values by one to force them to numbers > (eg: hrRate/1), and it should then add them correctly. > > > >This is sooo simple that I will kick myself as it is probably something > >extremely easy but not working right: > > > >I have a number (1.5) and by taking the form value say (13) and > >multiplying it by 1.5 returns 19.51?? > >That should be 19.50. Also I entered 12 and * 1.5 returned 1812. > > > >Here is my script. What am I doing wrong? > > > >hrRate is the form field. > >OTRate is hard coded to 1.5. > > > >This is a snippet of the script: > >---------------------------- > >otPayRate = hrRate * OTRate + hrRate; > >document.NewEmployeeForm.OvertimeRate.value = > >Math.round(otPayRate*100)/100; > > > > > >All I need to do is take someone's hourly rate and times it by 1.5 to > >get their Overtime rate. > > > >lack of sleep and too much beer right now LOL > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| ColdFusion MX7 and Flex 2 Build sales & marketing dashboard RIAâs for your business. Upgrade now http://www.adobe.com/products/coldfusion/flex2 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:271518 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

