-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathindex.htm
More file actions
60 lines (56 loc) · 1.54 KB
/
index.htm
File metadata and controls
60 lines (56 loc) · 1.54 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!DOCTYPE html>
<html>
<head>
<!--
JavaScript 6th Edition
Chapter 2
Hands-on Project 2-1
Author: Carter Rock
Date: 2/21/2021
Filename: index.htm
-->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Hands-on Project 2-1</title>
<link rel="stylesheet" href="styles.css" />
<script src="modernizr.custom.05819.js"></script>
</head>
<body>
<header>
<h1>
Hands-on Project 2-1
</h1>
</header>
<article>
<h2>Fahrenheit (° F) to Celsius (° C) converter</h2>
<form>
<fieldset>
<label for="fValue">
Enter temp in ° F
</label>
<input type="number" id="fValue" />
</fieldset>
<fieldset>
<button type="button" id="button">Convert to ° C</button>
</fieldset>
<fieldset>
<p>Temp in ° C</p>
<p id="cValue"> </p>
</fieldset>
</form>
</article>
<script>
function convert() {
var degF = document.getElementById("fValue").value;
var degC = (degF - 32) * (5 / 9);
document.getElementById("cValue").innerHTML = degC;
}
document.getElementById("button").
addEventListener("click", convert, false);
</script>
<footer>
<p id="validation">
<a href="http://validator.w3.org/check?uri=referer" title="HTML5 Validation">HTML5 Validation</a></p>
</footer>
</body>
</html>