Simple Auto Loan Calculator

Introduction | Demonstration Calculator | Source Code

How The Auto Loan Payment Calculator Works

This is a very simple calculator for calculating an auto loan payment. Enter in the amount of the loan, the number of months the loan is for, and the APR. Then click “Calculate Payment” to get your monthly auto loan payment.

If you change the values, click the “Calculate Payment” button again to get a new result.

Introduction | Demonstration Calculator | Source Code

Demonstration Calculator


Simple Auto Loan Calculator

Loan Amount:

Loan Term: months

APR Interest:

Payment:

Introduction | Demonstration Calculator | Source Code

Simple Auto Loan Payment Calculator Source Code

This calculator is licensed to you under Creative Commons Attribution 3.0. If you would like to use the source code on your site or create a derivative work from it, you must include the following HTML on the page where the calculator appears. We’re giving you this code for free with a legal license to use it. All you have to do is credit us in the manner we specify.

Required Credit HTML

INSTALLATION

Just cut and paste the Javascript code and HTML form below into your page. If you want to customize the appearance of the form, feel free. Just make sure the input name and form id/name values are not changed.


<script type="text/javascript">
function calcLoan() {

var formvals = getFormVal();

var months = formvals[0];

var loan = formvals[2];
var apr = formvals[1];

var mpr = apr / 1200;
var nfactor = 0 - months;
var mofactor = Math.pow((1 + mpr), nfactor);
var bofactor = 1 - mofactor;
var tofactor = mpr / bofactor;

var payment = loan * tofactor;
var reducto = Math.round(payment*100)/100;

document.wcbubba.payment.value = "$"+reducto;

if (amortsub) showAm();

}

function getFormVal(){

          var years = parseInt(document.wcbubba.term.value);
          var loan = parseInt(document.wcbubba.loan.value);
          var apr = parseFloat(document.wcbubba.apr.value);

          if((years <= 0)||(isNaN(years))) years = 1;
          if((apr <= 0)||(isNaN(apr))) apr = 1;
          if((loan <= 0)||(isNaN(loan))) loan = 1;

          var mike = new Array(years,apr,loan);

         return mike;
}
</script>

<form id="wcbubba" name="wcbubba" action="javascript:void();">

Loan Amount: <input type=text name="loan" size=8>

Loan Term: <input type=text name="term" size=8> months

APR Interest: <input type=text name="apr" size=8>

<br /><br />

<input type="submit" value="Calculate Payment" onClick="calcLoan();"> 

<br /><br />

<b>Payment:</b> <input type=text name = "payment" size=9><br>
</form></p>

Leave a Reply