• Recent Questions
  • Popular Questions

Math.round vs toFixed(2)?

Great card for rebuilding credit. Get pre-qualified now.

I’m trying to get the below ShowVal()
case study to return a value to
2 decimals. Where/how would I use
toFixed(2) instead of Math.round?

[CODE]

function ShowVal() {

var I=eval(document.
mortgage_calculator.
interest_rate.value);

var N=eval(document.
mortgage_calculator.
total_num_months.value);

var S=eval(document.
mortgage_calculator.
loan_amount.value);

Document.mortgage_
calculator.monthly
_pymt.value=Math.
round(Monthly(I,N,S)
*100)/100;

document.mortgage
_calculator.total
_pymts.value=Math
.round
(document.mortgage_
calculator
.monthly_pymt.value*N
*100)/100;
}

[/CODE]

Cheers!

Incoming search terms:

    Toadaly
    Posted 3 months ago

    calculator.monthly_pymt.value=
    Monthly(I,N,S).toFixed(2);

      KaptKos
      Posted 3 months ago

      Try something like this:

      Document.mortgage_calculator.
      monthly_pymt.value.toFixed(Monthly(I,N,S), 2)

    Answer this Question :

    You must be logged in to post an answer. Signup Here, it takes 5 seconds :)

    Other Questions