Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS How to assign a different background image everyday

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #32217
    Hair
    Member

    Can anybody point me to a tutorial on how to assign a different background image each day? Or if anybody can show me how to do this, I’d greatly appreciate since I’m really dumb in coding. Thank you.

    #52338
    Hair
    Member

    Wow it’s been 3 days and still no replies? Kindly just point me to a tut/s for my query.

    #52311
    soap
    Participant

    Yo man try not to demand things…


    function chgDailyImg()
    {
    var imagearray = new Array();
    imagearray[0] = "sundaypic.jpg";
    imagearray[1] = "mondaypic.jpg";
    imagearray[2] = "tuesdaypic.jpg";
    imagearray[3] = "wednesdaypic.jpg";
    imagearray[4] = "thursdaypic.jpg";
    imagearray[5] = "fridaypic.jpg";
    imagearray[6] = "saturdaypic.jpg";

    var d = new Date(); /*** create a date object for use ***/
    var i = d.getDay(); /*** use the date object to get the day of the week - this will be a number from 0 to 6 - sunday=0, saturday=6 -it's the way counting works in javascript it starts at 0 like in the arrays ***/
    document.getElementById("dailyImg").src = imagearray;
    }


    (not my code)

    #52263
    Hair
    Member

    Sorry man, I’m in a desperate situation. But thanks a lot, will try this out and will let you know.

    #52160
    jamygolden
    Member

    PHP Version:

    This will output (depending on the day):

    body{background: url(images/wednesday.jpg) no-repeat left top;}
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.