├── README.md ├── haze.png ├── mist.png ├── rain.png ├── clear.png ├── cloud.png ├── img04.jpg ├── darzizzl.png ├── LICENSE ├── script.js ├── index.html └── style.css /README.md: -------------------------------------------------------------------------------- 1 | # Weather App 2 | -------------------------------------------------------------------------------- /haze.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariharans07/PRODIGY_WD_05/HEAD/haze.png -------------------------------------------------------------------------------- /mist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariharans07/PRODIGY_WD_05/HEAD/mist.png -------------------------------------------------------------------------------- /rain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariharans07/PRODIGY_WD_05/HEAD/rain.png -------------------------------------------------------------------------------- /clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariharans07/PRODIGY_WD_05/HEAD/clear.png -------------------------------------------------------------------------------- /cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariharans07/PRODIGY_WD_05/HEAD/cloud.png -------------------------------------------------------------------------------- /img04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariharans07/PRODIGY_WD_05/HEAD/img04.jpg -------------------------------------------------------------------------------- /darzizzl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariharans07/PRODIGY_WD_05/HEAD/darzizzl.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Hariharan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /script.js: -------------------------------------------------------------------------------- 1 | var temp=document.getElementById('temp'); 2 | var cityName=document.getElementById('city') 3 | var humidity=document.getElementById('humidity') 4 | var windspeed=document.getElementById('windspeed') 5 | var searchinput=document.getElementById('searchinput'); 6 | var serchbox=document.getElementById('serchbox') 7 | var body_img=document.getElementById('body_img'); 8 | 9 | var body_data=document.getElementById('body_data') 10 | var deatil=document.getElementById('deatil') 11 | var error=document.getElementById('error') 12 | 13 | 14 | 15 | 16 | 17 | async function checkWeather(city) { 18 | let Upi_key='f27b269d54e4fa1e72993364a80fa8bd' 19 | let repsponse= await fetch(`https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${Upi_key}&units=metric`); 20 | let data= await repsponse.json(); 21 | 22 | 23 | 24 | temp.innerHTML=Math.floor(data.main.temp )+'°C'; 25 | cityName.innerHTML=data.name; 26 | humidity.innerHTML=data.main.humidity +"%"; 27 | windspeed.innerHTML=data.wind.speed+'km/h'; 28 | console.log(data) 29 | 30 | 31 | 32 | 33 | 34 | if (data.weather[0].main=="Clouds") { 35 | body_img.src='cloud.png' 36 | } 37 | else if (data.weather[0].main=='Clear') { 38 | body_img.src='clear.png' 39 | } 40 | else if (data.weather[0].main=='Rain') { 41 | body_img.src='rain.png' 42 | } 43 | else if (data.weather[0].main=='Drizzle') { 44 | body_img.src='darzizzl.png' 45 | } 46 | else if (data.weather[0].main=='Mist') { 47 | body_img.src='mist.png' 48 | } 49 | else if (data.weather[0].main=='Haze') { 50 | body_img.src='haze.png' 51 | } 52 | body_data.style.display='flex'; 53 | deatil.style.display='flex'; 54 | 55 | 56 | } 57 | 58 | 59 | serchbox.addEventListener('click',()=> 60 | { 61 | let cityIn = searchinput.value; 62 | checkWeather(cityIn); 63 | 64 | }) -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 |
24 | humidity
37 |wind speed
45 |