Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var citySelect=document.getElementById("city");citySelect.onchange=function(){loadWeather(this.options[this.selectedIndex].value)};
- var defaultCity="Hvar",weatherFields={temp:document.getElementById("weather-temp"),vlaga:document.getElementById("weather-moisture"),tlak:document.getElementById("weather-pressure"),tlakTend:document.getElementById("weather-pressureTend"),vjetarSmjer:document.getElementById("weather-windDirection"),vjetarBrzina:document.getElementById("weather-windSpeed"),vrijeme:document.getElementById("weather-weather")},city;
- for(city in weatherData.gradovi)if(weatherData.gradovi.hasOwnProperty(city)){var option=document.createElement("option");option.value=city;option.innerHTML=city;if(city===defaultCity)option.selected=true;citySelect.appendChild(option)}function loadWeather(b){for(var a in weatherFields)if(weatherFields.hasOwnProperty(a))weatherFields[a].innerHTML=weatherData.gradovi[b][a]}loadWeather(defaultCity);
Add Comment
Please, Sign In to add comment