<div data-ux="Element" id="bs-9" class="x-el x-el-div c1-1 c1-2 c1-b c1-c c1-d c1-e c1-f c1-g"><span data-ux="Element" class="x-el x-el-span c2-1 c2-2 c2-3 c2-4 c2-5 c2-6 c2-7 c2-8"><iframe id="iframe-undefined8" frameborder="0" sandbox="allow-scripts allow-same-origin allow-forms allow-popups allow-presentation allow-top-navigation" src="javascript: window.frameElement.getAttribute("srcdoc");" srcdoc="<script>window.onmessage = function(event) {event.source.postMessage({iframeId: event.data, scrollHeight: document.body.getBoundingClientRect().height || document.body.scrollHeight}, event.origin);};</script><body style='margin: 0;'><div style="display: flex; justify-content: center"><!-- (c) pnlfinancials. All rights reserved. This code may not be copied or reproduced without permission from pnlfinancials. --> <!DOCTYPE html> <html> <head> <title>Auto Loan Calculator</title> <style> body { font-family: Arial, sans-serif; background-color: #f1f1f1; } h1 { text-align: left; font-size: 4.5rem; margin-top: 0rem; margin-bottom: -500rem; } .container { width: 100%; min-height: 100%; background-color: #f6f6f6; border-radius: 0.5px; box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.3); padding: 1.5rem; margin-top: 0rem; margin-bottom: 0rem; } @media screen and (min-width: 100%) { .container { width: 100%; } } label { font-size: 100%; display: block; font-weight: bold; margin-bottom: 0.6rem; } input[type="number"], input[type="date"] { padding: 0.7rem; font-size: 0.9rem; border-radius: 13px; border: none; background-color: #ffffff; margin-bottom: 1.5rem; width: 80%; } button[type="button"] { background-color: #e53935; color: #fff; border: none; padding: 0.9rem 1.5rem; cursor: pointer; font-size: 1.3rem; border-radius: 9px; margin-top: 2rem; } table { border-collapse: collapse; width: Auto; margin-top: 2rem; } th, td { border: 1px solid #ddd; padding: 0.5rem; text-align: left; } th { background-color: #f1f1f1; } #results { margin-top: 1rem; text-align: center; } #results p { margin-bottom: 1rem; text-align: left; } #results strong { font-size: 1rem; text-align: left; } #results span { font-size: 1rem; font-weight: bold; color: #e53935; } #amortization { display: none; } #toggleAmortization { background-color: #e53935; color: #fff; border: none; padding: 0.9rem 1.5rem; cursor: pointer; font-size: 1.3rem; border-radius: 9px; margin-top: 2rem; } #monthlyPayment { font-size: 1.4rem; font-weight: bold; margin-top: 1.5rem; margin-bottom: 0.5rem; color: #000000; } #monthlyPaymentResult { font-size: 3rem; font-weight: bold; text-align: center; margin-top: 1rem; color: #e53935; } <!-- (c) pnlfinancials. All rights reserved. This code may not be copied or reproduced without permission from pnlfinancials. --> </style> <head> <title>Auto Loan Calculator</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale= 0"> <script> function calculateLoan() { // Get the input values var loanAmount = document.getElementById("loanAmount").value; var interestRate = document.getElementById("interestRate").value; var loanTerm = document.getElementById("loanTerm").value; var startDate = new Date(document.getElementById("startDate").value); // Calculate the monthly payment var monthlyInterestRate = interestRate / 1200; var numberOfPayments = loanTerm * 12; var monthlyPayment = loanAmount * monthlyInterestRate / (1 - (1 / Math.pow(1 + monthlyInterestRate, numberOfPayments))); // Display the monthly payment document.getElementById("monthlyPayment").innerHTML = "Monthly Payment: $" + monthlyPayment.toLocaleString('en-US', {maximumFractionDigits: 2}); // Calculate the amortization schedule var balance = loanAmount; var amortizationSchedule = "<table><tr><th>Payment Date</th><th>Interest Paid</th><th>Principal Paid</th><th>Remaining Balance</th></tr>"; for (var i = 1; i <= numberOfPayments; i++) { var interest = balance * monthlyInterestRate; var principal = monthlyPayment - interest; balance -= principal; var paymentDate = new Date(startDate.getTime() + (i-1) * 30 * 24 * 60 * 60 * 1000); // Add one month to the start date for each payment amortizationSchedule += "<tr><td>" + (paymentDate.getMonth() + 1) + "/" + paymentDate.getDate() + "/" + paymentDate.getFullYear() + "</td><td>$" + interest.toLocaleString('en-US', {maximumFractionDigits: 2}) + "</td><td>$" + principal.toLocaleString('en-US', {maximumFractionDigits: 2}) + "</td><td>$" + balance.toLocaleString('en-US', {maximumFractionDigits: 2}) + "</td></tr>"; } amortizationSchedule += "</table>"; document.getElementById("amortizationSchedule").innerHTML = amortizationSchedule; } function toggleAmortizationSchedule() { var amortizationSchedule = document.getElementById("amortizationSchedule"); if (amortizationSchedule.style.display === "none") { amortizationSchedule.style.display = "block"; document.getElementById("toggleAmortizationButton").innerHTML = "Hide Amortization Schedule"; } else { amortizationSchedule.style.display = "none"; document.getElementById("toggleAmortizationButton").innerHTML = "Show Amortization Schedule"; document.activeElement.blur(); } } <!-- (c) pnlfinancials. All rights reserved. This code may not be copied or reproduced without permission from pnlfinancials. --> </script> </head> <body> <!-- THIS IS THE PART WHERE I CAN ADD TOGGLES, ACTION BUTTONS, ADDITIONAL LINE, etc...--> <div class="container"> <form> <label for="loanAmount">What is the loan Amount?</label> <input type="number" id="loanAmount" name="loanAmount" required> <br> <label for="interestRate">Interest Rate:</label> <input type="number" id="interestRate" name="interestRate" step="0.01" required> <br> <label for="loanTerm">Loan Term (in years):</label> <input type="number" id="loanTerm" name="loanTerm" required> <br> <label for="startDate">Start Date:</label> <input type="date" id="startDate" name="startDate" required> <br> <button type="button" onclick="calculateLoan()">Calculate Monthly Payment</button> </form> <div id="monthlyPayment"></div> <br> <button type="button" id="toggleAmortizationButton" onclick="toggleAmortizationSchedule()">Show Amortization Schedule</button> <div id="amortizationSchedule" style="display: none;"></div> </div> </body> </html> <!-- (c) pnlfinancials. All rights reserved. This code may not be copied or reproduced without permission from pnlfinancials. --> </div></body>" style="width: 100%; overflow: visible; transition: height 1.5s ease 0s; height: 622.438px;"></iframe></span></div>
Write, Run & Share HTML code online using OneCompiler's HTML online Code editor for free. It's one of the robust, feature-rich online Code editor for HTML language, running on the latest version HTML5. Getting started with the OneCompiler's HTML compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as HTML
. You can also specify the stylesheet information in styles.css
tab and scripts information in scripts.js
tab and start coding.
HTML(Hyper Text Markup language) is the standard markup language for Web pages, was created by Berners-Lee in the year 1991. Almost every web page over internet might be using HTML.
<!DOCTYPE html>
<html>
and ends with </html>
<h1>
to <h6>
where <h1>
is the highest important heading and <h6>
is the least important sub-heading.<p>..</p>
tag.<a>
tag.
<a href="https://onecompiler.com/html">HTML online compiler</a>
<img>
tag, where src
attribute consists of image name.<button>..</button>
tag<ul>
for unordered/bullet list and <ol>
for ordered/number list, and the list items are defined in <li>
.<a href="https://onecompiler.com/html">HTML online compiler</a>
CSS(cascading style sheets) describes how HTML elements will look on the web page like color, font-style, font-size, background color etc.
Below is a sample style sheet which displays heading in green and in Candara font with padding space of 25px.
body{
padding: 25px;
}
.title {
color: #228B22;
font-family: Candara;
}
<table>
tag.<tr>
tag<th>
tag<td>
tag<caption>
tag<script>
is the tag used to write scripts in HTML<script src="script.js"></script>