Complete Code For Converting From MPH To KPH Using Javascript
<!DOCTYPE html> <html> <head> <title>How Can I Convert From MPH To KPH Using Javascript</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet"> </head> <style> body { background: black; } .form-control{ width:80%;!important; } </style> <body> <body> <div class="container"> <br/><br/> <div class="text-center"> <h1 id="color" style="color: white;">Convert From MPH To KPH Using Javascript</h1> </div> <div class="well"> <p> <label>MPH</label> <input id="inputMPH" class="form-class" type="number" placeholder="MPH" oninput="speedConverter(this.value)" onchange="speedConverter(this.value)"> </p> <p>KPH: <span id="outputKPH"></span></p> <script> function speedConverter(valNum) { document.getElementById("outputKPH").innerHTML=valNum*1.609344; } </script> </div> </div> </body> </html>