JSFiddle - React, Tailwind, and code Playground
by Shirly Manor
HTML
<head>
<title>ROI Calculator</title>
<script src="script.js"></script>
<script>
function sumInputs8() {
var sum = 0;
var avg = Number(document.getElementById('avg').value);
var mon = Number(document.getElementById('mon').value);
var inc = Number(document.getElementById('inc').value);
var tot = document.getElementById('tot');
var visInc = Math.round(Number(((inc/100 + 1) * mon)))
sum = ((visInc *avg)-(mon *avg))
tot.textContent = (sum).toLocaleString()
sum = 0
}
</script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Compact Form</title>
<style>
body {
font-family: Arial, sans-serif;
}
.container {
max-width: 400px;
margin: 0 auto;
}
.arr {
display: flex;
align-items: center;
margin-bottom: 10px;
}
.arr p {
flex: 1;
margin: 0;
}
.arr input[type="number"] {
width: 150px;
text-align: right;
}
.arr img {
width: 20px;
margin-right: 5px;
}
#calculate {
width: 100%;
background-color: #007BFF;
color: #fff;
border: none;
padding: 10px;
cursor: pointer;
}
#calculate:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class="container">
<div class="inputs">
<div class="arr">
<p>The Average value of a visit (estimated):</p>
<input type="number" id="avg" value="10"> $
</div>
<div class="arr">
<p>Monthly visitors (SimilarWeb)</p>
<input type="number" id="mon" value="4000000">
</div>
<div class="arr">
<p>Monthly visitors...