Forums

This topic is locked

Function help

Posted 06 Mar 2003 21:57:45
1
has voted
06 Mar 2003 21:57:45 E. Bar posted:
Hi!

I need that the function below works with "," and 2 decimal places.

Tks.


function calculate(){
var oForm = document.IncluiProcesso;
var pv,ir,nq,t,tot;

with(oForm){
pv = new Number(ValorOperacao.value);
t = new Number(ValoresAdicionais.value);
ir = new Number(Taxa.value);
nq = new Number(Parcelas.value);

tot = (pv+t)*(ir/100)/(1-(1/(Math.pow(1+(ir/100),nq))))*nq
tot = (Math.round(tot * 100))/100;

SubTotal.value = tot
}
}

Reply to this topic