Equity Calculator
Here is an example code for an Equity Calculator using HTML, CSS, and JavaScript. It is responsive and can be easily customized to fit your needs.
HTML:
php
Copy code
Equity Calculator
CSS:
css
Copy code
* {
box-sizing: border-box;
font-family: Arial, sans-serif;
}
.calculator-container {
max-width: 500px;
margin: 0 auto;
padding: 20px;
}
h1 {
text-align: center;
}
.form-container {
margin-bottom: 20px;
}
form {
display: flex;
flex-direction: column;
}
label {
margin-bottom: 5px;
}
input[type="number"] {
padding: 5px;
margin-bottom: 10px;
}
button {
padding: 5px;
background-color: #007bff;
color: #fff;
border: none;
cursor: pointer;
margin-top: 10px;
}
button:hover {
background-color: #0062cc;
}
.result-container {
text-align: center;
}
p {
font-size: 18px;
font-weight: bold;
}
span {
color: #007bff;
}
JavaScript:
javascript
Copy code
const calculateEquity = () => {
const investment = document.getElementById('investment').value;
const valuation = document.getElementById('valuation').value;
const shares = document.getElementById('shares').value;
if (investment && valuation && shares) {
const equity = (investment / valuation) * shares;
document.getElementById('equity').textContent = equity.toFixed(2);
} else {
alert('Please enter all values.');
}
};
document.getElementById('calculate-btn').addEventListener('click', calculateEquity);
This code will create an Equity Calculator with input fields for Investment Amount, Company Valuation, and Number of Shares. When the user clicks the Calculate Equity button, the JavaScript function will calculate and display the user's equity in the company based on their inputs. The CSS will style the calculator and make it responsive for different screen sizes
Equity Calculator
Your Equity:
Comments
Post a Comment