JavaScript/weather/weather.js
// Changes a background picture of a webpage and a weather icon depending on a weather code
Changes a background picture of a webpage and a weather icon depending on a weather code
Changes a background picture of a webpage and a weather icon depending on a weather code
function insertPic (someid) {
    if (someid >= 200 && someid < 300) {
        $('#body').css({'background-image': 'url(thunderstorm.jpg)'});
        $('#icon').html("<img src='4.png'/>");
    } else if (someid >= 300 && someid <= 531) {
        $('#body').css({'background-image': 'url(rain.jpg)'});
        $('#icon').html("<img src='3.png'/>");
    } else if (someid >= 600 && someid <= 622) {
        $('#body').css({'background-image': 'url(snow.jpg)'});
        $('#icon').html("<img src='5.png'/>");
    } else if (someid >= 701 && someid <= 781) {
        $('#body').css({'background-image': 'url(fog.jpg)'});
        $('#icon').html("<img src='6.png'/>");
    } else if (someid === '800') {
        $('#body').css('background-image', 'url(sun.JPG)');
        $('#icon').html("<img src='1.png'/>");
    } else if (someid >= 801 && someid <= 804) {
        $('#body').css('background-image', 'url(clouds.jpg)');
        $('#icon').html("<img src='2.png'/>");
    } else if (someid >= 900 && someid <= 962) {
        $('#body').css('background-image', 'url(warning.jpg)');
    }
}
function insertPic ( someid ) { if ( someid >= 200 && someid < 300 ) { $ ( '#body' ) . css ( { 'background-image' : 'url(thunderstorm.jpg)' } ) ; $ ( '#icon' ) . html ( "<img src='4.png'/>" ) ; } else if ( someid >= 300 && someid <= 531 ) { $ ( '#body' ) . css ( { 'background-image' : 'url(rain.jpg)' } ) ; $ ( '#icon' ) . html ( "<img src='3.png'/>" ) ; } else if ( someid >= 600 && someid <= 622 ) { $ ( '#body' ) . css ( { 'background-image' : 'url(snow.jpg)' } ) ; $ ( '#icon' ) . html ( "<img src='5.png'/>" ) ; } else if ( someid >= 701 && someid <= 781 ) { $ ( '#body' ) . css ( { 'background-image' : 'url(fog.jpg)' } ) ; $ ( '#icon' ) . html ( "<img src='6.png'/>" ) ; } else if ( someid === '800' ) { $ ( '#body' ) . css ( 'background-image' , 'url(sun.JPG)' ) ; $ ( '#icon' ) . html ( "<img src='1.png'/>" ) ; } else if ( someid >= 801 && someid <= 804 ) { $ ( '#body' ) . css ( 'background-image' , 'url(clouds.jpg)' ) ; $ ( '#icon' ) . html ( "<img src='2.png'/>" ) ; } else if ( someid >= 900 && someid <= 962 ) { $ ( '#body' ) . css ( 'background-image' , 'url(warning.jpg)' ) ; } }
Changes a background picture of a webpage and a weather icon depending on a weather code
Changes a background picture of a webpage and a weather icon depending on a weather code