Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
vaishnavisingh20 authored Oct 16, 2023
1 parent 8368b57 commit 26abdd0
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
42 changes: 42 additions & 0 deletions TempWizard/indexsamp.html
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>
30 changes: 30 additions & 0 deletions TempWizard/script.js
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));
}
29 changes: 29 additions & 0 deletions TempWizard/style.css
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;
}

0 comments on commit 26abdd0

Please sign in to comment.