SHARE
TWEET

Untitled

a guest Aug 24th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <title>Julian's Loan Calculator</title>
  5.         <style>
  6.         h1 {
  7.             color: blue;
  8.         }
  9.         </style>
  10.     </head>
  11.     <body>
  12.         <h1 align="middle">Loan Calculator</h1>
  13.         <p align="center"><b>Calculate your loan repayment below</b></p>
  14.         <hr />
  15.        
  16.         <label>Enter your name</label><br />
  17.         <input type="textbox" id="name"/><br /><br />      
  18.         <script>
  19.         function    computeLoan(){
  20.         var amount = document.getElementById('amount').value;
  21.         var interest_rate = document.getElementById('interest_rate').value;
  22.         var months = document.getElementById('months').value;
  23.         var interest = (amount * (interest_rate * .01)) / months;
  24.         var payment = ((amount / months) + interest).toFixed(2);
  25.         payment = payment.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
  26.         document.getElementById('payment').innerHTML = "Monthly Payment = $"+payment;
  27.         }
  28.         </script>
  29.         <p>Loan Amount: $<input id="amount" type="number" min="1" max="10000000" onchange="computeLoan()"></p>
  30.         <p>Interest Rate: <input id="interest_rate" type="number" min="1" max="100" value="9" step=".1" onchange="computeLoan()"></p>
  31.         <p>Months: <input id="months" type="number" min="1" max="72" value="1" step="1" onchange="computeLoan()"></p>
  32.         <h2 id="payment"></h2>
  33.          
  34.        
  35.        
  36.            
  37.     </body>
  38. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top