-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhw3part3.html
More file actions
82 lines (80 loc) · 3.22 KB
/
hw3part3.html
File metadata and controls
82 lines (80 loc) · 3.22 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html lang="en">
<head>
<!--Kristian Reyes 9/26/2020 -->
<title>CNIT 133 Homework 3</title>
<meta charset="utf-8">
<meta name="description" content="homework 3 for CCSF CNIT 133">
<meta name="keywords" content="HTML, CSS, Javascript, CCSF, Student">
<meta name="author" content="Kristian Reyes">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<!--bootstrap -->
<!-- jquery validation -->
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.min.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
function convCelsius() {
var temp = parseInt(document.getElementById("temp").value);
temp = 5/9 * (temp - 32);
showConversion(temp)
}
function convFahrenheit() {
var temp = parseInt(document.getElementById("temp").value);
temp = (9/5 * temp) + 32;
showConversion(temp)
}
function showConversion(temp) {
document.getElementById("results").innerHTML = Math.round(temp);
}
</script>
<body>
<main class="grid">
<header class="grid-area grid-area-1">
<h1> Homework 3 - Part 3 </h1>
</header>
<nav class="grid-area grid-area-2">
<ul>
<li>
<a href="homework3.html" title="CNIT 133 - HW 3">
Return to CNIT 133 Homework 3 - Functions
</a>
</li>
</ul>
</nav>
<section class="grid-area grid-area-3">
<h2> HW 3 - Part 3 </h2>
<h2>
Temperature Converter</h2>
<form name="myform" id="myform">
<table>
<tr>
<td> Temperature to Convert:</td>
<td><input id="temp" type="number"></td>
</tr>
<tr>
<td><button type="button" onclick="convCelsius()">Convert Temperature to Celsius</button></td>
</tr>
<tr>
<td><button type="button" onclick="convFahrenheit()">Convert Temperature to Fahrenheit</button></td>
</tr>
<tr>
<td> Conversion Result:</td>
<td><input id="results" type="number" readonly></td>
</tr>
</table>
</form>
</section>
<footer class="grid-area grid-area-4">
<p>
© 2020 Kristian Reyes
</p>
</footer>
</main>
</body>
</html>