-
-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #340 from vaishnavisingh20/main
Merge TempWizard - A temperature converter
- Loading branch information
Showing
3 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<html> | ||
<head> | ||
<link rel="stylesheet" type="text/css" href="style.css"> | ||
</head> | ||
<body> | ||
<div><h1>TEMPERATURE CONVERTER</h1></div> | ||
<div> | ||
<div> | ||
<div style="float:left"> | ||
<div><h1><label>Fahrenheit</label></h1></div> | ||
<div><input type="number" | ||
id="fahrenheit"> </div> | ||
</div> | ||
<div style="float:left"> | ||
|
||
<img src="https://cdn-icons-png.flaticon.com/512/5105/5105291.png" alt="image" height="200px"> | ||
</div> | ||
</div> | ||
<div> | ||
<div style="float:left"> | ||
<div><h1><label>Celsius</label></h1></div> | ||
<div><input type="number" | ||
id="celsius"> </div> | ||
</div> | ||
<div style="float:left"> | ||
<img src="https://cdn-icons-png.flaticon.com/512/578/578113.png" alt="image" height="200px"> | ||
</div> | ||
</div> | ||
<div> | ||
<div style="float:left"> | ||
<div><h1><label>Kelvin</label></h1></div> | ||
<div><input type="number" | ||
id="kelvin"> </div> | ||
</div> | ||
<div style="float:left"> | ||
<img src="https://cdn-icons-png.flaticon.com/512/4958/4958677.png" alt="image" height="200px"> | ||
</div> | ||
</div> | ||
</div> | ||
<script src="script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
let celsius = | ||
document.getElementById('celsius'); | ||
let fahrenheit = | ||
document.getElementById('fahrenheit'); | ||
let kelvin = | ||
document.getElementById('kelvin'); | ||
celsius.oninput = function () { | ||
let f = (parseFloat(celsius.value) * 9) / 5 + 32; | ||
fahrenheit.value = parseFloat(f.toFixed(2)); | ||
|
||
let k = (parseFloat(celsius.value) + 273.15); | ||
kelvin.value = parseFloat(k.toFixed(2)); | ||
} | ||
fahrenheit.oninput = function () { | ||
let c = ((parseFloat( | ||
fahrenheit.value) - 32) * 5) / 9; | ||
celsius.value = parseFloat(c.toFixed(2)); | ||
|
||
let k = (parseFloat( | ||
fahrenheit.value) - 32) * 5 / 9 + 273.15; | ||
kelvin.value = parseFloat(k.toFixed(2)); | ||
} | ||
kelvin.oninput = function () { | ||
let f = (parseFloat( | ||
kelvin.value) - 273.15) * 9 / 5 + 32; | ||
fahrenheit.value = parseFloat(f.toFixed(2)); | ||
|
||
let c = (parseFloat(kelvin.value) - 273.15); | ||
celsius.value = parseFloat(c.toFixed(2)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
body { | ||
font-family: Arial, sans-serif; | ||
text-align: center; | ||
margin: 0; | ||
padding: 0; | ||
background-color: #f0f0f0; | ||
} | ||
|
||
h1{ | ||
padding:5%; | ||
padding-bottom:3%; | ||
font-size:50px; | ||
color:green; | ||
} | ||
|
||
div{ | ||
padding-left:1% | ||
} | ||
|
||
label{ | ||
margin: 10px 0; | ||
} | ||
input | ||
{ | ||
border:none; | ||
height:50px; | ||
width:200px; | ||
font-size:40px; | ||
} |