ASDV-WebDev/Assignments/JavaScript/lab12js_CalebFontenot/public_html/Problem2.html

24 lines
965 B
HTML

<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/Other/html.html to edit this template
-->
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript">
var input = prompt("Please enter a temperature to convert!");
var toCelcius = prompt("Do you want to convert to celcius?");
if (toCelcius == "true" || toCelcius == "yes") {
var celcius = 5 / 9 * (input - 32);
document.write( input +" in Celcius is " + celcius + "C");
} else {
var fahrenheit = (input * 5/9) + 32;
document.write(input + "in Fahrenheit is " + fahrenheit + "F")
}
</script>
</head>
</html>