-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemp.html
50 lines (43 loc) · 1.31 KB
/
temp.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Temperature Converter</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin: 50px;
}
input {
width: 200px;
padding: 10px;
box-sizing: border-box;
margin-bottom: 10px;
}
button {
padding: 10px;
cursor: pointer;
}
div {
margin-top: 20px;
font-size: 18px;
font-weight: bold;
}
</style>
</head>
<body>
<h1>Temperature Converter</h1>
<input type="text" id="celsiusInput" placeholder="Enter temperature in Celsius">
<button onclick="convertTemperature()">Convert to Fahrenheit</button>
<div id="result"></div>
<script>
function convertTemperature() {
var celsiusTemperature = document.getElementById("celsiusInput").value;
var fahrenheitTemperature = (celsiusTemperature * 9/5) + 32;
document.getElementById("result").textContent = "Converted temperature: " + fahrenheitTemperature + " °F";
}
</script>
</body>
</html>