Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: auto change BG

  1. #1
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,043
    Thanks
    19
    Thanked 42 Times in 42 Posts

    auto change BG

    is there a way to automatically fade change the colour of a BG every15 seconds? i know its done onclick but dont know how on a set interval
    thanks

  • #2
    New Coder
    Join Date
    Apr 2007
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by rafiki View Post
    is there a way to automatically fade change the colour of a BG every15 seconds? i know its done onclick but dont know how on a set interval
    thanks
    i originally made this to give people seizures....
    but with some changes, it can do that, but fading would be complicated

    <script>
    var interval = 15 ; //set the interval in seconds
    var a=new Array(); //create an array for the colors
    var i=1;//to keep track on the current color
    a[1]='red';//first color
    a[2]='blue';//second color
    a[3]='green';//third color
    function c(){
    document.bgColor=a[i];
    i++;
    if(i>3){
    i=1
    }
    setTimeout('c()',interval*1000)
    }
    c();
    </script>

  • #3
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,043
    Thanks
    19
    Thanked 42 Times in 42 Posts
    thanks ill take a look, i take it it goes in <head> tags?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •