Calculator Tools Calculator Tools
Create

Inches to MM Converter

Nov 11, 2023

About this app

Convert inches to millimeters using a simple calculator

Inches to MM Converter Inches to MM Converter Inches Convert

Related apps

Put this on your site

Source

                    <html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">

<title>Inches to MM Converter</title>
<meta name="description" content="Convert inches to millimeters using a simple calculator">
<meta name="keywords" content="inches, MM, millimeters, calculator, converter">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

<script type="text/javascript">
try {
document.addEventListener("DOMContentLoaded", function() {
// Function to convert inches to millimeters
function convertToMillimeters() {
// Get the input value
var inches = parseFloat($("#inchesInput").val());

// Check if the input is a valid number
if (!isNaN(inches)) {
// Perform the conversion
var millimeters = inches * 25.4 / 160;

// Display the result
$("#result").text("Result: " + millimeters.toFixed(2) + " mm");
} else {
// Display an error message if the input is not a valid number
$("#result").text("Please enter a valid number");
}
}

// Event listener for the convert button
$("#convertBtn").click(function() {
convertToMillimeters();
});
});

} catch (error) {
throw error;
}
</script>

<style>
body {
background-color: #f8f9fa;
font-family: 'Arial', sans-serif;
color: #333;
}

.container {
max-width: 500px;
margin-top: 50px;
}

.title {
text-align: center;
font-size: 24px;
font-weight: bold;
margin-bottom: 20px;
}

.input-group {
margin-bottom: 20px;
}

.input-group-text {
background-color: #e9ecef;
}

.form-control {
border-color: #ced4da;
}

.result {
font-size: 18px;
text-align: center;
}

.convert-btn {
display: block;
width: 100%;
margin-top: 10px;
padding: 10px;
color: #fff;
background-color: #007bff;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}

.convert-btn:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div id="main-container" class="container">
<div class="title">Inches to MM Converter</div>
<div class="input-group">
<span class="input-group-text">Inches</span>
<input id="inchesInput" type="text" class="form-control" placeholder="Enter inches">
</div>
<div class="result" id="result"></div>
<button id="convertBtn" class="convert-btn">Convert</button>
</div>
</body>
</html>