How To Convert From Feet To Miles Using Javascript

admin_img Posted By Bajarangi soft , Posted On 21-11-2020

Using Javascript and HTML we can create an input element that can convert a value from feet into miles . So for that we use formula miles=feet*0.00018939.

How To Convert From Feet To Miles Using Javascript

Complete Code For Converting From Feet To Miles Using Javascript.

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>How To Convert From Feet To Miles Using Javascript</title>
    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">
</head>
<style>
    body {
        background: chocolate;
    }
</style>
<body>
<body>
<div class="container">
    <br/><br/>
    <div class="text-center">
        <h1 id="color" style="color: white;">Convert From Feet To Miles Using Javascript</h1>
    </div>

    <div class="well">
        <p>
            <label>Feet</label>
            <input id="inputFeet" type="number" placeholder="Feet" oninput="LengthConverter(this.value)" onchange="LengthConverter(this.value)">
        </p>
        <p>Miles: <span id="outputMiles"></span></p>

        <script>
            function LengthConverter(valNum) {
                document.getElementById("outputMiles").innerHTML=valNum*0.00018939;
            }
        </script>

    </div>
</div>
</body>
</html>

Related Post