Math.round vs toFixed(2)?

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!

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

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay

?>