Created
February 24, 2017 14:55
-
-
Save IanMcT/4fe7699ce330605f53537b6227473bd7 to your computer and use it in GitHub Desktop.
Basis for Temp Converter - HMTL and JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
</head> | |
<body> | |
<p>Temp: <br /> | |
<input type="text" id="tempInput" /><br /> | |
<input id="radioCT" type="radio" name="conversionType" value="CToF" checked>Celsius to Fahrenheit</input><br /> | |
<input id="radioCT" type="radio" name="conversionType" value="FToC">Fahrenheit to Celsius</input><br /> | |
<button onclick="convertTemp()">Convert</button> | |
</p> | |
<p id="output"> </p> | |
<script> | |
function convertTemp() | |
{ | |
alert("in function"); | |
var t = document.getElementById("tempInput").value; | |
alert(t); | |
var convertCtoF = document.getElementById("radioCT").checked; | |
alert(convertCtoF); | |
if(convertCtoF){ | |
document.getElementById("output").innerHTML = "convert c to f"; | |
}else{ | |
document.getElementById("output").innerHTML = "convert f to c"; | |
} | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment