[thelist] Javascript - round to 2 decimal points

Tim Snadden lists at snadden.com
Fri May 22 20:16:30 CDT 2009


On 23/05/2009, at 12:47 PM, Bob Meetin wrote:

> I have a simple script that does a volume calculation if you enter  
> the 3
> values of length, width, height.  see it at
> http://dottedi.biz/codesamples/volume_calc.html
>
> What I don't know how to do is to use "tofixed(2)" in the script to  
> set
> the number of decimal points to 2 in the Cubic Yards output.
>

Hi Bob. It's case sensitive and need to be toFixed rather than  
tofixed. Also it needs to operate on a number rather than a string. Try

parseInt(myform.cuyd.value).toFixed(3)

Hope that helps. Cheers, Tim



More information about the thelist mailing list