B
Buzby
Probably a very basic question but I'm completely stuck.
I have a simple function that takes a quantity and a price and
multiplies it.
function
Item1(f){f['TP1'].value=Number(f['Quant1'].value)*Number(f['Price1'].val
ue);
Quant1 is taken from a text form field and Price1 from a hidden form
field.
When Quant1 is changed by calling function Item1
onchange="Item1(this.form);" the calculated price is displayed in form
field TP1.
This works perfectly - but occasionally it displays an odd number
ie: 5 x 4.97 = 24.849999999999998
Any pointers as to how I get it to format to 2 decimal places - I've
tried all sorts but to no avail
TIA!
I have a simple function that takes a quantity and a price and
multiplies it.
function
Item1(f){f['TP1'].value=Number(f['Quant1'].value)*Number(f['Price1'].val
ue);
Quant1 is taken from a text form field and Price1 from a hidden form
field.
When Quant1 is changed by calling function Item1
onchange="Item1(this.form);" the calculated price is displayed in form
field TP1.
This works perfectly - but occasionally it displays an odd number
ie: 5 x 4.97 = 24.849999999999998
Any pointers as to how I get it to format to 2 decimal places - I've
tried all sorts but to no avail
TIA!