Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temp #311

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Temp #311

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion css/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
* {
background-color: silver;
text-align: center;
}

h1 {
color: blue;
color: rgb(77, 77, 113);
}

.input {
background-color: whitesmoke;
width : 75vw;
height: 30px;
}

.btn-container {
margin: 15px 0px;
}

.temp-area {
width: 85vw;
margin: 0 auto;
font-size: 50px;
background-color: black;
color: white;
}
19 changes: 18 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,24 @@
<title>Hello Front-End</title>
</head>
<body>
<h1>Hello Front-End</h1>
<h1>Temperature Convertor</h1>
<input type="number" class="input"/>
<div class ="btn-container">
<button class="FtoC"> F TO C</button>
<button class="CtoF"> C TO F</button>
</div>
<div class ="btn-container">
<button class="submit-btn"> Submit</button>
<button class="clear-btn"> Clear</button>
</div>

<div class="temp-area">


</div>


<h2>Howdy</h2>

<script type="text/javascript" src="js/script.js"></script>
</body>
Expand Down
30 changes: 29 additions & 1 deletion js/script.js
Original file line number Diff line number Diff line change
@@ -1 +1,29 @@
console.log('Hello, front end');
let input = document.querySelector(".input")
let fToc = document.querySelector(".ftoc")
let cTof = document.querySelector(".ctof")
let submit = document.querySelector(".submit-btn")
let clear = document.querySelector(".clear-btn")
let tempArea =document.querySelector(".temp-area")

let fConversion = function() {
let preConversionValue = input.value
let postConversionValue = (preConversionValue -32) * 5/9
tempArea.innerText =postConversionValue
}
let cConversion = function() {
let preConversionValue = input.value
let postConversionValue = (preConversionValue *9/5) +32
tempArea.innerText =postConversionValue
}

let clearText = function () {
tempArea.innerText = ""
}

fToc.addEventListener ("click", fConversion)
cTof.addEventListener ("click", fConversion)
clear.addEventListener("click", clearText)