| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>─=≡Σ((( つ•̀ω•́)つ</title> |
|
|
| <style> |
| body { |
| font-family: Arial, sans-serif; |
| margin: 0; |
| padding: 0; |
| margin-top: 5px; |
| background-color: #f4f4f4; |
| } |
| |
| .container { |
| display: flex; |
| flex-wrap: wrap; |
| gap: 10px; |
| justify-content: space-between; |
| align-items: center; |
| width: 98%; |
| margin: auto; |
| padding: 5px; |
| background-color: #ffffff; |
| border-radius: 10px; |
| box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2); |
| } |
| |
| .input-with-background, .input-with-background2 { |
| position: relative; |
| flex: 1; |
| min-width: 100px; |
| } |
| |
| .input-with-background input, .input-with-background2 input { |
| width: 100%; |
| height: 20px; |
| font-size: 12px; |
| padding-right: 40px; |
| border: 1px solid #ccc; |
| border-radius: 5px; |
| box-sizing: border-box; |
| padding-left: 10px; |
| } |
| |
| .input-with-background::after, .input-with-background2::after { |
| position: absolute; |
| top: 50%; |
| right: 10px; |
| transform: translateY(-50%); |
| color: #888; |
| pointer-events: none; |
| white-space: nowrap; |
| font-size: 12px; |
| } |
| |
| .input-with-background::after { |
| content: '% (年利率)'; |
| } |
| |
| .input-with-background2::after { |
| content: '元'; |
| } |
| </style> |
| </head> |
| <body> |
| <div class="container"> |
| <div class="input-with-background2"> |
| <input type="number" id="principal" value="50000" step="10000" placeholder="请输入金额"> |
| </div> |
| <div class="input-with-background"> |
| <input type="number" id="rate" placeholder="请输入年利率" value="1" required> |
| </div> |
| <div class="input-with-background2"> |
| <input id="totalAmount" value="收益: 0" readonly> |
| </div> |
| <div class="input-with-background2"> |
| <input id="perHourEarnings" placeholder="每小时" readonly> |
| </div> |
| <div class="input-with-background2"> |
| <input id="perDayEarnings" placeholder="每天" readonly> |
| </div> |
| <div class="input-with-background2"> |
| <input id="perMonthEarnings" placeholder="每月" readonly> |
| </div> |
| <div class="input-with-background2"> |
| <input id="perYearEarnings" placeholder="每年" readonly> |
| </div> |
| </div> |
| <audio id="coinSound" src="/page/wav/rmb.wav"></audio> |
| <audio id="bigWinSound" src="/page/wav/rmb2.wav"></audio> |
|
|
| <script> |
| let intervalId = null; |
| let lastAmountForSound = 0; |
| let totalAmount = 0; |
| |
| function startCalculation() { |
| clearInterval(intervalId); |
| const principal = parseFloat(document.getElementById("principal").value); |
| const rate = parseFloat(document.getElementById("rate").value); |
| totalAmount = principal; |
| lastAmountForSound = totalAmount; |
| const perSecondInterest = (principal * (rate / 100) / 365 / 24 / 60 / 60); |
| |
| intervalId = setInterval(() => { |
| totalAmount += perSecondInterest; |
| document.getElementById("totalAmount").value = ` ${totalAmount.toFixed(6)}`; |
| updateEarnings(perSecondInterest); |
| |
| let increaseAmount = totalAmount - lastAmountForSound; |
| |
| if (increaseAmount >= 10) { |
| playSound("bigWinSound"); |
| lastAmountForSound = totalAmount; |
| } else if (increaseAmount >= 1) { |
| playSound("coinSound"); |
| lastAmountForSound = totalAmount; |
| } |
| }, 1000); |
| } |
| |
| function updateEarnings(perSecondInterest) { |
| const perMinute = perSecondInterest * 60; |
| const perHour = perMinute * 60; |
| const perDay = perHour * 24; |
| const perMonth = perDay * 30; |
| const perYear = perDay * 365; |
| |
| document.getElementById("perHourEarnings").value = `每小时: ${perHour.toFixed(2)}`; |
| document.getElementById("perDayEarnings").value = `每天: ${perDay.toFixed(2)}`; |
| document.getElementById("perMonthEarnings").value = `每月: ${perMonth.toFixed(2)}`; |
| document.getElementById("perYearEarnings").value = `每年: ${perYear.toFixed(2)}`; |
| } |
| |
| function playSound(soundId) { |
| const sound = document.getElementById(soundId); |
| if (sound) { |
| sound.pause(); |
| sound.currentTime = 0; |
| sound.play().catch(error => console.error("Audio play failed", error)); |
| } |
| } |
| |
| function stopCalculation() { |
| clearInterval(intervalId); |
| intervalId = null; |
| } |
| |
| document.getElementById("principal").addEventListener("input", () => { |
| stopCalculation(); |
| startCalculation(); |
| }); |
| |
| document.getElementById("rate").addEventListener("input", () => { |
| stopCalculation(); |
| startCalculation(); |
| }); |
| |
| window.onload = startCalculation; |
| </script> |
|
|
| <script> |
| document.addEventListener('DOMContentLoaded', function () { |
| const monthsInput = document.getElementById('months'); |
| const rateInput = document.getElementById('rate'); |
| monthsInput.addEventListener('change', function () { |
| const selectedMonths = monthsInput.value; |
| const selectedRate = monthsToRate[selectedMonths]; |
| if (selectedRate) { |
| rateInput.value = selectedRate; |
| } |
| }); |
| }); |
| </script> |
| <script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script> |
| <script>LA.init({ id: "JRHGRBPWC7lJIaXq", ck: "JRHGRBPWC7lJIaXq" })</script> |
| </body> |
| </html> |