Skip to main content


This topic contains 17 replies, has 10 voices, and was last updated by  sagarleo1 1 month, 1 week ago.

Viewing 3 posts - 16 through 18 (of 18 total)
  • Author
  • #279755


    Rather then 10 seconds how about 24 hours a new background.



    I think that would either have to be coded server side (in case the page is not served with only HTML but is inserted with PHP for example) or if you want an approach on the user’s end, you could go with window.localStorage and check the last time the page was visited – if that was more than a day ago, then change the background.



    Hii, I have given you the code (JavaScript), try it yourself and share the result

    var i = 0;
    function change() {
    var doc = document.getElementById(“background”);
    var color = [“black”, “blue”, “brown”, “green”]; = color[i];
    i = (i + 1) % color.length;
    setInterval(change, 1000);

Viewing 3 posts - 16 through 18 (of 18 total)

You must be logged in to reply to this topic.

icon-link icon-logo-star icon-search icon-star