-
Notifications
You must be signed in to change notification settings - Fork 0
/
faren_to_degree
33 lines (30 loc) · 952 Bytes
/
faren_to_degree
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html>
<style>
body {
background-image: url("https://images.pexels.com/photos/1366942/pexels-photo-1366942.jpeg?auto=compress&cs=tinysrgb&h=350");
background-size: cover; }
div{
border-style: dotted;
}
</style>
<body style="text-align:center;">
<h1 style="padding-top:45px">Celcius and Fahrenhet conversion</h1>
<div style="padding-top:20px"> <input id="c" onkeyup="convert('c')" style="margin-top:40px"><br>Degrees Celsius<br><br>
<input id="f" onkeyup="convert('f')" style="margin-top:40px"><br>Degrees Fahrenheit<br>
</div>
<script>
function convert(degree) {
var x;
if (degree == "c") {
x =document.getElementById("c").value * 9 / 5 + 32;
document.getElementById("f").value =Math.round(x);
}
else {
x = (document.getElementById("f").value -32) * 5 / 9;
document.getElementById("c").value = Math.round(x);
}
}
</script>
</body>
</html