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

Allison Huston T Convert HW #314

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
37 changes: 36 additions & 1 deletion css/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
body {
background-color: rgb(119, 193, 233);

}

h1 {
color: blue;
color: black;
text-align: center;
font-size: 55px;
margin:60px;
font-family: 'Josefin Sans', sans-serif;
}


p {
text-align: center;
font-size: 32px;
font-family: 'Josefin Sans', sans-serif;
}

.inputTools {
text-align: center;
font-family: 'Josefin Sans', sans-serif;

}

.input {

}



#result {
text-align: center;
font-size: 24px;
padding: 60px

}
26 changes: 23 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,31 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/style.css">
<title>Hello Front-End</title>
<title>Temperature Converter</title>
<script defer type="text/javascript" src="js/script.js"></script>
</head>
<body>
<h1>Hello Front-End</h1>

<h1>Temperature Converter</h1>
<p>Helping you understand what the temperature is in the rest of the world!</p>

<div class="inputTools">

<input class="input" id="Temperature" placeholder="Enter the temp" type="number"/>
<input class="cToF" type="radio" name="temp" id="celsius">
<label for="celsius">Celsius</label>
<input class="fToC"type="radio" name="temp" id="fahrenheit">
<label for="fahrenheit">Fahrenheit</label>

<button id="submitButton">Submit</button>

<button id="clearButton" value="reset">Clear</button>

<script type="text/javascript" src="js/script.js"></script>
</div>

<div id="result">

</div>

</body>
</html>
55 changes: 54 additions & 1 deletion js/script.js
Original file line number Diff line number Diff line change
@@ -1 +1,54 @@
console.log('Hello, front end');

let fToC = function(tempInF){
const tempInC = (tempInF - 32) * 5/9
return tempInC
}
// fToC.addEventListener('click', fToC)
// let cToF = function(tempInC){
// const tempInF = (tempInC * 9/5) + 32
// return tempInF
// }
//the math
//F->C (32°F − 32) × 5/9 = 0°C

//(32°C × 9/5) + 32 = 89.6°F

// let input = document.querySelector(".input")
// let input = document.querySelector(".cToF")
// let input = document.querySelector(".fToC")
// let input = document.querySelector(".submitButton")
// let input = document.querySelector(".clearButton")




// temp input
const input = document.querySelector("#Temperature")
console.log(input)

const result = document.querySelector("#result")
console.log(`The temp is ${result}`)

//action for submitting info
const submitButton = document.querySelector("#submitButton");
console.log(submitButton)
submitButton.addEventListener('click', function(){
console.log(input.value)
const temp = fToC(input.value)
result.innerText = temp
})

// action to reset
const clearButton = document.querySelector("#clearButton");
console.log(clearButton)
clearButton.addEventListener("click", function(){
console.log("")
result.innerText = ""
})

/*set to clear answer and not input value, oops. At least something gets cleared?*/


//let clearButton = function() {
// input.innerText = ""
//} in class