Emergency Fund Calculator
Info
Created On: September 22, 2023
Created By:
Tags
AI
Model: chatgpt-plugin
Time: 0 seconds
Prompt Tokens: 0
Completion Tokens: 0
Total Token Cost: 0
Get This App On Your Website
Copy Code
1. Copy the code above with the iframe and link.
2. Paste the code into your website.
3. Resize the iframe to fit your website.
Javascript, HTML, CSS Code
Copy
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript"> window.addEventListener('error', function(event) { var message = JSON.parse(JSON.stringify(event.message)); var source = event.filename; var lineno = event.lineno; var colno = event.colno; var error = event.error; window.parent.postMessage({ type: 'iframeError', details: { message: message, source: source, lineno: lineno, colno: colno, error: error ? error.stack : '' } }, '*'); }); window.addEventListener('unhandledrejection', function(event) { window.parent.postMessage({ type: 'iframePromiseRejection', details: { reason: event.reason } }, '*'); }); </script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Emergency Fund Calculator</title>
<style>
.container {
width: 300px;
margin: 50px auto;
padding: 20px;
border: 1px solid #ddd;
box-shadow: 2px 2px 12px #aaa;
}
.input-group {
margin-bottom: 10px;
}
label {
display: block;
margin-bottom: 5px;
}
input[type="number"] {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
width: 100%;
padding: 10px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
}
#results {
margin-top: 20px;
}
</style>
<link rel="canonical" href="https://calculator.tools/prompt/6889/">
<meta charset="utf-8">
</head>
<body>
<div class="container">
<h1>Emergency Fund Calculator</h1>
<p>Hey there! I'm an AI, and I'm here to help you calculate your emergency fund. Let's get started!</p>
<div class="input-group">
<label for="rent">Monthly Rent/Mortgage ($):</label>
<input type="number" id="rent" placeholder="Enter amount">
</div>
<div class="input-group">
<label for="utilities">Utilities ($):</label>
<input type="number" id="utilities" placeholder="Enter amount">
</div>
<div class="input-group">
<label for="groceries">Groceries ($):</label>
<input type="number" id="groceries" placeholder="Enter amount">
</div>
<div class="input-group">
<label for="transportation">Transportation ($):</label>
<input type="number" id="transportation" placeholder="Enter amount">
</div>
<div class="input-group">
<label for="health">Health ($):</label>
<input type="number" id="health" placeholder="Enter amount">
</div>
<div class="input-group">
<label for="entertainment">Entertainment ($):</label>
<input type="number" id="entertainment" placeholder="Enter amount">
</div>
<div class="input-group">
<label for="misc">Miscellaneous Expenses ($):</label>
<input type="number" id="misc" placeholder="Enter amount">
</div>
<button onclick="calculate()">Calculate</button>
<div id="results"></div>
</div>
<script>
function calculate() {
var rent = parseFloat(document.getElementById('rent').value) || 0;
var utilities = parseFloat(document.getElementById('utilities').value) || 0;
var groceries = parseFloat(document.getElementById('groceries').value) || 0;
var transportation = parseFloat(document.getElementById('transportation').value) || 0;
var health = parseFloat(document.getElementById('health').value) || 0;
var entertainment = parseFloat(document.getElementById('entertainment').value) || 0;
var misc = parseFloat(document.getElementById('misc').value) || 0;
var totalExpenses = rent + utilities + groceries + transportation + health + entertainment + misc;
var emergencyFund = totalExpenses * 6; // Assuming 6 months of expenses
document.getElementById('results').innerHTML = '<p><strong>Total Monthly Expenses:</strong> $' + totalExpenses.toFixed(2) + '</p>' +
'<p><strong>Recommended Emergency Fund:</strong> $' + emergencyFund.toFixed(2) + '</p>';
}
</script>
<script type="text/javascript"> var localStoragePrefix = "ct-{{ cachebreaker }}"; var lastSave = 0; function saveLocal(data) { if (Date.now() - lastSave < 1000) { return; } let cookie = localStoragePrefix + "=" + JSON.stringify(data) + "; path=" + window.location.pathname + "'; SameSite=Strict"; cookie += "; expires=" + new Date(Date.now() + 1000 * 60 * 60 * 24 * 365 * 1000).toUTCString(); document.cookie = cookie; lastSave = Date.now(); } function loadLocal() { var cookiePrefix = localStoragePrefix + "="; var cookieStart = document.cookie.indexOf(cookiePrefix); if (cookieStart > -1) { let cookieEnd = document.cookie.indexOf(";", cookieStart); if (cookieEnd == -1) { cookieEnd = document.cookie.length; } var cookieData = document.cookie.substring(cookieStart + cookiePrefix.length, cookieEnd); return JSON.parse(cookieData); } } </script>
<script type="text/javascript"> window.addEventListener('load', function() { var observer = new MutationObserver(function() { window.parent.postMessage({height: document.documentElement.scrollHeight || document.body.scrollHeight},"*"); }); observer.observe(document.body, {attributes: true, childList: true, subtree: true}); window.parent.postMessage({height: document.documentElement.scrollHeight || document.body.scrollHeight},"*"); }); </script>
</body>
</html>