Pet Supplies & Health Products Online Store with Free Shipping in USA
Pet Supplies & Health Products Online Store with Free Shipping in USA
In this video we write the scritp to calculate the monthly payment . We also write a rounding script plus I explain how we display the html table using document.getElementById.

A working version of the calculator can be found online at

#Buy a #home #Mortgage #Loans #RealEstate #Morgagebroker
how to #finance a #house or #land


  • I used this code now its good but i need date, can you set month with Pmt date like 1/1/2017, 2/1/2017, 3/1/2017 or like January 01, 2017, Feb. 01, 2017, March 01, 2017, can you do that? I request, I appreciate your work, Like, Share and Comment here. Thanks .

  • Hi Brian Veitch

    sorry to bother you

    i'm creating a similar calculator and would like to display the year counter in the first row and the "payment", "balance", "interest" in the first column with all corresponding values in the corresponding cells.

    i have tried to populate the table in the while loop but i don't know is there is a way to do it without repeating to much.

    like table += "<tr class='table_info'><td>"+round(monthly_payment,2)+"</td><td>"+round(monthly_payment,2)+"</td><td>"+round(monthly_payment,2)+"</td><td>"+round(monthly_payment,2)+"</td></tr>";

    if you could give me any ideas it would be great, i'm really lost and i want the code to be as clean as possible.

    thank you in advance

  • Hi Brian

    thanks for posting this great tutorial

    i'm really new to programming and i'm trying to understand the logic under the variable "var monthly_payment"

    would you please share the mathematical formula you used to create this variable

    thank you.

  • where i can find the code to download

  • Hi Brian,

    Thanks for your video, which I have found extremely helpful as I'm really new to programming. Unfortunately, I got stuck on video 5, after entering the loan formula and have not been able to carry on with the additional videos. Please can you take a quick look at what I have coded, as you may be able to spot whatever I'm missing with fresh eyes, many thanks.

    function startOver () {



    function validate () {

    var loan_amt = document.loan_form.loan_amt.value;
    var months = document.loan_form.months.value;
    var rate = document.loan_form.rate.value;
    var extra = document.loan_form.extra.value;

    if (loan_amt <= 0|| isNaN(Number(loan_amt)) ) {
    alert("Please enter a valid loan amount.");
    document.loan_form.loan_amt.value ="";
    else if (months <= 0|| parseInt(months) != months ) {
    alert("Please enter a valid number of months.");
    else if (rate <= 0|| rate > 99 || isNaN(Number(rate)) ){
    alert("Please enter a valid interest rate.");
    else if (extra < 0 || isNaN(Number(extra)) ) {
    alert("Please enter a valid extra payment.");
    else {
    calculate(parseFloat(loan_amt), parseInt(months), parseFloat(rate), parseFloat(extra));


    function calculate (loan_amt, months, rate, extra) {

    var monthly_payment = (loan_amt*(rate/(100*12)))*(Math.pow((rate/(100*12)),months))/ (Math.pow((rate/(100*12)),months)-1);
    return monthly_payment;

  • Hi Brian, I have enjoyed your tutorials and believe you can help me with JavaScript for some money transfer calculations on my website. I'm willing to pay for it. Please let me know if you can help. I can give you the website address privately if you are ready to help. Looking forward to your response

  • Thanks Brian!
    I press the button and nothing works, I'll try and debug it first, then use the code if I fail. Thanks again

  • When you say it doesn't work, do you mean the amortization table won't show up or the box that shows the calculated monthly payment?

  • I posted a link in the video description above to where I have that version of the calculator online.
    Just right click to get the source code, stylesheet, and js file.

  • Hi Brian, I got this far and my calc won't work!
    Is there any chance of putting the code up somewhere please?

Leave a Reply