Untitled
unknown
plain_text
a year ago
3.5 kB
4
Indexable
<!DOCTYPE html> <html lang="no"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Låneskjema</title> <style> body { font-family: Arial, sans-serif; margin: 20px; } form { max-width: 500px; margin: auto; padding: 20px; border: 1px solid #ccc; border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } label { display: block; margin-bottom: 8px; font-weight: bold; } input[type="number"] { width: 100%; padding: 8px; margin-bottom: 20px; border: 1px solid #ccc; border-radius: 5px; } button { width: 100%; padding: 10px; background-color: #4CAF50; color: white; border: none; border-radius: 5px; cursor: pointer; } button:hover { background-color: #45a049; } .result { margin-top: 20px; font-weight: bold; } </style> </head> <body> <form id="loanForm"> <h2>Låneskjema</h2> <label for="loanAmount">Lånebeløp:</label> <input type="number" id="loanAmount" name="loanAmount" required> <label for="loanTerm">Løpetid (i år):</label> <input type="number" id="loanTerm" name="loanTerm" required> <label for="establishmentFee">Etableringsgebyr:</label> <input type="number" id="establishmentFee" name="establishmentFee" required> <label for="registrationFee">Tinglysningsgebyr:</label> <input type="number" id="registrationFee" name="registrationFee" required> <label for="monthlyFee">Månedsgebyr:</label> <input type="number" id="monthlyFee" name="monthlyFee" required> <label for="nominalInterestRate">Nominell rente (%):</label> <input type="number" step="0.01" id="nominalInterestRate" name="nominalInterestRate" required> <button type="button" onclick="calculateEffectiveInterest()">Beregn effektiv rente</button> <div class="result" id="effectiveInterestRateResult"></div> </form> <script> function calculateEffectiveInterest() { // Hent verdier fra skjemaet const loanAmount = parseFloat(document.getElementById('loanAmount').value); const loanTerm = parseFloat(document.getElementById('loanTerm').value); const establishmentFee = parseFloat(document.getElementById('establishmentFee').value); const registrationFee = parseFloat(document.getElementById('registrationFee').value); const monthlyFee = parseFloat(document.getElementById('monthlyFee').value); const nominalInterestRate = parseFloat(document.getElementById('nominalInterestRate').value); // Beregn årlige kostnader const annualNominalRate = nominalInterestRate / 100; const annualMonthlyFees = monthlyFee * 12; const totalFees = establishmentFee + registrationFee + (annualMonthlyFees * loanTerm); const totalLoanCost = loanAmount + totalFees; const annualEffectiveRate = ((totalLoanCost / loanAmount) ** (1 / loanTerm)) - 1; const effectiveInterestRate = (annualEffectiveRate * 100).toFixed(2); // Vis resultatet document.getElementById('effectiveInterestRateResult').innerText = `Effektiv rente: ${effectiveInterestRate}%`; } </script> </body> </html>
Editor is loading...
Leave a Comment