Cómo crear: Convertidor de velocidad
- Página anterior Conversión de longitud
- Página siguiente Caja de herramientas CodeW3C.com
Aprende a crear un convertidor de velocidad utilizando HTML y JavaScript.
Convertidor de velocidad
Escribe un valor en cualquier campo para realizar la conversión entre medidas de velocidad:
Create a speed converter
Create an input element that can convert one speed measurement unit to another.
First step - Add HTML:
<p> <label>MPH</label> <input id="inputMPH" type="number" placeholder="MPH" oninput="speedConverter(this.value)" onchange="speedConverter(this.value)" </p> <p>KPH: <span id="outputKPH"></span></p>
Second step - Add JavaScript:
Miles per hour to kilometers per hour:
/* When the input field receives input, convert the value from mph to kph */ function speedConverter(valNum) { valNum = parseFloat(valNum); document.getElementById("outputKPH").innerHTML = valNum * 1.609344; }
Convert MPH to other measurement units
The following table shows how to convert MPH to other speed measurement units:
Description | Formula | Example |
---|---|---|
Convert MPH to KPH | KPH = MPH * 1.609344 | Prueba |
Convert MPH to knots | knots = MPH / 1.150779 | Prueba |
Convert MPH to Mach | Mach = MPH / 761.207 | Prueba |
Convert KPH to other measurement units
The following table shows how to convert KPH to other speed measurement units:
Description | Formula | Example |
---|---|---|
Convert KPH to MPH | MPH = KPH / 1.609344 | Prueba |
Convert KPH to knots | knots = KPH / 1.852 | Prueba |
Convert KPH to Mach | Mach = KPH / 1225.044 | Prueba |
Convert knots to other measurement units
The following table shows how to convert knots to other speed measurement units:
Description | Formula | Example |
---|---|---|
Convert knots to MPH | MPH = knots * 1.150779 | Prueba |
Convert knots to KPH | KPH = knots * 1.852 | Prueba |
Convert knots to Mach | Mach = knots / 661.4708 | Prueba |
Convert Mach to other measurement units
The following table shows how to convert Mach number to other speed measurement units:
Description | Formula | Example |
---|---|---|
Convert Mach to MPH | MPH = Mach * 761.207 | Prueba |
Convert Mach to KPH | KPH=Mach*1225.044 | Prueba |
Convertir Mach a nudos | nudos=Mach*661.4708 | Prueba |
- Página anterior Conversión de longitud
- Página siguiente Caja de herramientas CodeW3C.com