Site Tools


car

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
car [2026/04/04 22:53] admincar [2026/04/04 23:11] (current) – [Table] admin
Line 1: Line 1:
-====== Loan Calculator ====== +Loan Amount ($)           | 35000                                                                  | 
- +Annual Interest Rate (%)  | 2.9                                                                    | 
-<form> +Duration (Years)                                                                               | 
-# No action line here - this prevents server-side errors +| **Monthly Payment**       | ~~=round((r1c1/1200 * r0c1) / (1 (1 + r1c1/1200)**(-r2c1*12)), 2)~~  | 
-fieldset "Loan Details" +| **Total Interest Paid**   | ~~=round((r3c1 * r2c1 * 12) - r0c1, 2)~~                               | 
-  number "Principal Amount" "10000" >0 +| **Total Cost**            | ~~=round(r0c1 + r4c1, 2)~~                                             |
-  number "Annual Interest Rate (%)" "5" >0 +
-  number "Loan Duration (Years)" "5" >0 +
-  static "output_area" " " +
-submit "Calculate" +
-</form> +
- +
-<js> +
-document.addEventListener("DOMContentLoaded", function() { +
-    // Select the form - Bureaucracy forms use the class .bureaucracy__form +
-    var form document.querySelector(".bureaucracy__form"); +
-    if (!form) return; +
- +
-    form.onsubmit = function(e) { +
-        // Stop the form from ever reaching the server +
-        e.preventDefault()+
-        e.stopPropagation(); +
- +
-        // Target the 3 number inputs +
-        var inputs = form.querySelectorAll('input.edit'); +
-        var p = parseFloat(inputs[0].value);  +
-        var r_annual = parseFloat(inputs[1].value);  +
-        var n_years = parseFloat(inputs[2].value);  +
- +
-        if (p > 0 && r_annual > 0 && n_years > 0) { +
-            var r = r_annual / 100 / 12; // Monthly rate +
-            var n = n_years * 12;       // Total months +
-             +
-            // Loan Amortization Formula +
-            var x = Math.pow(1 + r, n)+
-            var m = (p x) / (1); +
-            var totalPaid = m n; +
-            var totalInterest = totalPaid - p; +
-             +
-            // Find the static field and inject results +
-            var display = form.querySelector(".bureaucracy__static")+
-            display.innerHTML = ` +
-                <div style="margin-top: 20px; padding: 20px; background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05);"> +
-                    <h3 style="margin-top:0; color:#0056b3;">Loan Summary</h3> +
-                    <p style="font-size:1.1em;"><strong>Monthly Payment:</strong> $${m.toFixed(2)}</p> +
-                    <hr style="border:0; border-top:1px solid #eee;"> +
-                    <p><strong>Total Interest Paid:</strong> $${totalInterest.toFixed(2)}</p> +
-                    <p><strong>Total Cost of Loan:</strong> $${totalPaid.toFixed(2)}</p> +
-                </div> +
-            `; +
-        } else { +
-            alert("Please enter valid positive numbers in all fields."); +
-        } +
-        return false; +
-    }; +
-}); +
-</js> +
car.1775343216.txt.gz · Last modified: by admin