Template:FahrenheitToCelsiusForm

From Empire of Dragons
Revision as of 12:19, 21 February 2024 by Oberoten (talk | contribs) (Created page with "<form> Fahrenheit: <input type="text" name="fahrenheit" id="fahrenheit_input"><br> <input type="button" value="Convert" onclick="convertToFahrenheit()"> </form> <div id="celsius_result"></div> <script> function convertToFahrenheit() { var fahrenheit = document.getElementById("fahrenheit_input").value; var celsius = (fahrenheit - 32) * 5/9; document.getElementById("celsius_result").innerHTML = "Celsius: " + celsius.toFixed(2); } <...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<form>

   Fahrenheit: <input type="text" name="fahrenheit" id="fahrenheit_input">
<input type="button" value="Convert" onclick="convertToFahrenheit()">

</form>

<script>

   function convertToFahrenheit() {
       var fahrenheit = document.getElementById("fahrenheit_input").value;
       var celsius = (fahrenheit - 32) * 5/9;
       document.getElementById("celsius_result").innerHTML = "Celsius: " + celsius.toFixed(2);
   }

</script>