Template:FahrenheitToCelsiusForm: Difference between revisions

From Empire of Dragons
Jump to navigation Jump to search
(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); } <...")
 
No edit summary
Line 1: Line 1:
<form>
{{#widget:Textbox|id=fahrenheit_input}}
    Fahrenheit: <input type="text" name="fahrenheit" id="fahrenheit_input"><br>
{{#widget:Button|value=Convert|onclick=convertToFahrenheit}}
    <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);
    }
</script>

Revision as of 12:25, 21 February 2024

{{#widget:Textbox|id=fahrenheit_input}} {{#widget:Button|value=Convert|onclick=convertToFahrenheit}}