Javascript Convert Weight Converter poject

Javascript Convert Weight Converter project


<!DOCTYPE html>
<html>
<title>Pounds to Kilograms Weight Converter</title>
<style>
body {
font-family: sans-serif;
}

input#inPnd {
padding: 10px;
background: rgb(255, 255, 255);
border: none;
color: #2e2020;
font-size: 18px;
box-shadow: 0 4px 5px #0003;
}

.container {
width: 25%;
background: #8559ff;
padding: 14px;
box-shadow: 0px 4px 10px #0000002e;
margin: auto;
color: #fff;
}

.wrapper {
background: #a57eff;
padding: 10px;
color: white;
font-size: 20px;
}
</style>

<body>
<div class="container">
<h2>Convert Weight Converter</h2>
<p>Type a value in the Pounds field to convert the value to Kilograms:</p>
<div class="wrapper">
<p>
<label>Pounds</label>
<input id="inPnd" type="number" placeholder="1 Pounds" oninput="weightConverter(this.value)"
onchange="weightConverter(this.value)">
</p>
<span>Kilograms: <span id="okg"></span>0.453592 kg</span>
</div>

</div>

<script>
function weightConverter(vninnum) {
document.getElementById("okg").innerHTML = vninnum / 2.2046;
}
</script>

</body>

</html>
Reactions

Post a Comment

0 Comments