Show transcribed image text
Expert Answer
- Comment
<!DOCTYPE html> <html> <script> function ToCelsius() { var fh = parseInt(document.getElementById("fahrenheitTxt").value); document.getElementById("f2HTxt").value = (5/9) * (fh - 32); } function ToFahrenheit() { var cel = parseInt(document.getElementById("celsiusTxt").value); document.getElementById("fahSpan").innerHTML = (9/5) * cel + 32; } function Random() { var min = 5, max = 30; var randVal = Math.floor((Math.random() * (max - min)) + min); document.getElementById("randId").innerHTML = randVal; } </script> <body> Type a temperatre in Fahrenheit : <input type="text" id="fahrenheitTxt"><br><br> Type a temperatre in Celsius : <input type="text" id="celsiusTxt"><br><br> The Temperature result after Conversion from Fahrenheit to Celsius : <input type="text" id="f2HTxt"><br><br> The Temperature in Fahrenheit : <span id="fahSpan"> </span><br> <br><br> <button onclick = "ToCelsius()">ToCelsius</button> <button onclick = "ToFahrenheit()">ToFahrenheit</button> <button onclick = "Random()">Random(5-30)</button><br><br> The random number between [5-30] is <span id="randId"> </span><br> </body> </html>
Code
Output
ليست هناك تعليقات:
إرسال تعليق