Hi
wonder if somebody could help me out with this one.
I'm using the following code:
function cpu()
{
var cqu = "cof.cqr.value";
var cpu = "cof.cphr.value";
var amount=Math.round(((eval(cqu))*(eval(cpu)))*100)/100;
var final = "cof.cpr.value="+amount;
eval(final);
}
Note:cof.cqr, cof.cphr & cof.cpr =the dom path to form elements.
This takes a quantity value from one text box and * another value with it returning the result and rounding down to two decimal places.
Problem is that trailing zeros get lost along the way. I need to display them. So 2*1.25 = 2.5 at them moment but I need it to read 2.50. The solution shouldn't upset other value by just adding a 0 on the end whilly nilly. For example 2*1.24=2.48 not 2.480
I kinda need an answer on this one urgently but is has baffled
me. Can anyone help please?
MattyUK
wonder if somebody could help me out with this one.
I'm using the following code:
function cpu()
{
var cqu = "cof.cqr.value";
var cpu = "cof.cphr.value";
var amount=Math.round(((eval(cqu))*(eval(cpu)))*100)/100;
var final = "cof.cpr.value="+amount;
eval(final);
}
Note:cof.cqr, cof.cphr & cof.cpr =the dom path to form elements.
This takes a quantity value from one text box and * another value with it returning the result and rounding down to two decimal places.
Problem is that trailing zeros get lost along the way. I need to display them. So 2*1.25 = 2.5 at them moment but I need it to read 2.50. The solution shouldn't upset other value by just adding a 0 on the end whilly nilly. For example 2*1.24=2.48 not 2.480
I kinda need an answer on this one urgently but is has baffled

MattyUK
Comment