[Solved] How to change a background depending on the current day [closed]


In your comments you said javascript would be ok, so here it is in javascript.

This will do it for you: https://jsfiddle.net/4p18mxg9/5/

JAVASCRIPT

    function myFunction() {
    switch (new Date().getDay()) {
    case 0:
        day = "Sunday";
        document.body.style.backgroundImage = "url('http://lorempixel.com/400/200/sports/1/')";
        break;
    case 1:
        day = "Monday";
        document.body.style.backgroundImage = "url('http://lorempixel.com/400/200/sports/1/')";
        break;
    case 2:
        day = "Tuesday";
        document.body.style.backgroundImage = "url('http://lorempixel.com/400/200/sports/1/')";
        break;
    case 3:
        day = "Wednesday";
        document.body.style.backgroundImage = "url('http://lorempixel.com/400/200/sports/1/')";
        break;
    case 4:
        day = "Thursday";
        document.body.style.backgroundImage = "url('http://lorempixel.com/400/200/sports/1/')";
        break;
    case 5:
        day = "Friday";
        document.body.style.backgroundImage = "url('http://lorempixel.com/400/200/sports/1/')";
        break;
    case 6:
        day = "Saturday";
        document.body.style.backgroundImage = "url('http://lorempixel.com/400/200/sports/1/')";
        break;
}
 document.getElementById("demo").innerHTML = "Today is " + day;   


}

1

solved How to change a background depending on the current day [closed]