Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formating number in output

Status
Not open for further replies.

aggregate

Programmer
Oct 2, 2003
13
0
0
US
I have the following script

function slabCalc(form) {
l = eval(form.length.value);
w = eval(form.width.value);
d = eval(form.depth.value);
dinches = eval(d/12);
cu = eval((l*w*dinches)/27);
form.cu.value = cu

}

That calculates amount of concrete need by using form vars. The only problem I have is that the result is display with to many digits after the decimal. I only want to display 2.

Any help would be great
 
Or you could use the toFixed() method

formName.Name.value.toFixed(2)



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top