JavaScript TEMPERATURE CONVERSION PROGRAM 🌡️

preview_player
Показать описание
#JavaScript #project #programming

00:00:00 HTML
00:04:20 CSS
00:10:43 JavaScript

// TEMPERATURE CONVERSION PROGRAM

let temp;

function convert(){

temp = temp * 9 / 5 + 32;
}
temp = (temp - 32) * (5/9);
}
else{
}
}
Рекомендации по теме
Комментарии
Автор

// TEMPERATURE CONVERSION PROGRAM

const textBox =
const toFahrenheit =
const toCelsius =
const result =
let temp;

function convert(){

if(toFahrenheit.checked){
temp = Number(textBox.value);
temp = temp * 9 / 5 + 32;
result.textContent = temp.toFixed(1) + "°F";
}
else if(toCelsius.checked){
temp = Number(textBox.value);
temp = (temp - 32) * (5/9);
result.textContent = temp.toFixed(1) + "°C";
}
else{
result.textContent = "Select a unit";
}
}

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My website</title>
<link rel="stylesheet" href="style.css">
</head>
<body>

<form>
<h1>Temperature conversion:</h1>
<input type="number" id="textBox" value="0"><br>

<input type="radio" id="toFahrenheit" name="unit">
<label for="toFahrenheit">Celsius ➡ Fahrenheit</label><br>

<input type="radio" id="toCelsius" name="unit">
<label for="toCelsius">Fahrenheit ➡ Celsius</label><br>

<button type="button"
<p id="result"></p>
</form>

<script src="index.js"></script>
</body>
</html>

body{
font-family: Arial, sans-serif;
background-color: hsl(0, 0%, 95%);
}

h1{
color: hsl(223, 100%, 64%);
}

form{
background-color: hsl(0, 0%, 100%);
text-align: center;
max-width: 350px;
margin: auto;
padding: 25px;
border-radius: 10px;
box-shadow: 5px 5px 15px hsla(0, 0%, 0%, 0.3);
}

#textBox{
width: 50%;
text-align: center;
font-size: 2em;
border: 2px solid hsla(0, 0%, 0%, 0.8);
border-radius: 4px;
margin-bottom: 15px;
}

label{
font-size: 1.5em;
font-weight: bold;
}

button{
margin-top: 15px;
background-color: hsl(0, 100%, 60%);
color: white;
font-size: 1.5em;
border: none;
padding: 10px 15px;
border-radius: 5px;
cursor: pointer;
}

button:hover{
background-color: hsl(0, 100%, 50%);
}

#result{
font-size: 1.75em;
font-weight: bold;
}

BroCodez
Автор

Hi guys! If this code also does not work for you and you are sure that you did everything as in this video, then simply change the <form> tag to <div> save and check the code again, this method worked for me. I hope I helped you!

drufloud
Автор

Bro i am 14 and i have learnt ur python course and doing this this is soo good and clear even a 12 year old can do it with your explanation Love from Pakistan

FUN_X_GAME
Автор

excellent brilliant you make it so easy and understandable Thank you, Bro you are truly the best

meredithmed
Автор

bro code i just wanna thank you for helping me learn how to code. you're a huge W man, best of luck to u

jelapanoo
Автор

<*_> This is my seal. I have watched the entire video, understood it, and I can explain it in my own words, thus I have gained knowledge. This is my seal. <_*>

piotrmazgaj
Автор

I tried the code out and it’s awesome 👍

opiirix
Автор

New to this channel sir but your explanation i m founding very helpful just at class 10th but want to do ccommerce and python both . LOVE FROM INDIA❤

rajac
Автор

Hey bro, i want to thank you and tell you i appreciate you teaching all of us coding and i learned css and im learning JavaScript with your videos, unfortunately i couldn't use the calculator that we made in this lesson, I checked the codes from html, css, JavaScript and i have an exact copy if your codes and yet the results show NaN

Hayulukuchu
Автор

My bro can u make pandas vidoes or ai with python vidoes pls, tysm for ur effort

Tanjiro__Kamado
Автор

The numbers u used in temp is math function for temperature ? Right

mr.kachoo
Автор

Actually submit button is in the form element. when I hit submit button it shows the result and quickly disappeared. I came to know that it's because of default refresh of page when form got submitted. how could I prevent this from quick refresh.

onlyformonthlytest
Автор

What code do you reccommend to start with?

xpp_
Автор

Hi bro can you make django course or not?

Blitzwasd
Автор

Tried the same thing, but code is not working😢

ko_GaZEr
Автор

@Bro CodeWhre can i DM you personally i @ need some help with vs code and and Javascript

reyalstseaB