RPM to FPM Calculator
This calculator helps you convert Revolutions Per Minute (RPM) to Feet Per Minute (FPM).
function calculateFPM() {
var rpm = document.getElementById("rpm").value;
var diameter = document.getElementById("diameter").value;
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = ""; // Clear previous results
// Input validation
if (isNaN(rpm) || rpm === "" || isNaN(diameter) || diameter === "") {
resultDiv.innerHTML = "Please enter valid numbers for RPM and Diameter.";
return;
}
if (rpm < 0 || diameter < 0) {
resultDiv.innerHTML = "Please enter non-negative values.";
return;
}
// Calculation
// FPM = RPM * Pi * Diameter
var fpm = parseFloat(rpm) * Math.PI * parseFloat(diameter);
resultDiv.innerHTML =
"
Result: " + fpm.toFixed(2) + " Feet Per Minute (FPM)";
}
.calculator-container {
font-family: sans-serif;
border: 1px solid #ccc;
padding: 20px;
border-radius: 8px;
max-width: 400px;
margin: 20px auto;
box-shadow: 2px 2px 8px rgba(0,0,0,0.1);
}
.calculator-container h2 {
text-align: center;
margin-bottom: 15px;
color: #333;
}
.calculator-container p {
text-align: center;
margin-bottom: 20px;
color: #555;
line-height: 1.6;
}
.input-section {
margin-bottom: 15px;
}
.input-section label {
display: block;
margin-bottom: 5px;
font-weight: bold;
color: #444;
}
.input-section input[type="number"] {
width: calc(100% – 12px); /* Adjust for padding */
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
box-sizing: border-box; /* Include padding and border in the element's total width and height */
}
button {
display: block;
width: 100%;
padding: 10px 15px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #0056b3;
}
#result {
margin-top: 20px;
text-align: center;
font-size: 1.1em;
color: #333;
}
#result p {
margin: 0;
}