https://www.w3schools.com/howto/howto_js_weight_converter.asp

https://www.w3schools.com/howto/howto_js_temperature_converter.asp

https://www.w3schools.com/howto/howto_js_length_converter.asp

https://www.w3schools.com/howto/howto_js_speed_converter.asp


<!DOCTYPE html>
<html>
<title>MPH to KPH Speed Converter</title>
<body>

<h2>Speed Converter</h2>
<p>Type a value in the MPH field to convert the value to KPH:</p>

<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>

<script>
function speedConverter(valNum) {
document.getElementById(“outputKPH”).innerHTML=valNum*1.609344;
}
</script>

</body>
</html>

最後修改日期: 2022 年 4 月 14 日

作者

留言

撰寫回覆或留言

發佈留言必須填寫的電子郵件地址不會公開。