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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & 
Flex 2. 
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:271494
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to