Thread: Timebased event
View Single Post
Old 10-04-2009, 07:58 PM   #3 (permalink)
Tanax
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Thanks, that worked quite well.
However, it doesn't work exactly how I want it to.

You see, that only changes the header once. I want it to change every x seconds.
I tried to make a hack for it like this:
javascript Code:
$(document).ready(function() {

    function myfunction()
    {
       
        // This will hold our timer
        var myTimer = {};
       
        myTimer = $.timer(2000, function(){

            // Load the new image.
            $("#head").load("HeaderChanger.php");

        });
   
    }
   
    while(true)
    {
   
        setTimeout("myfunction()", 2000);
   
    }

});

however that only seems to work twice because it changes 2 times after the page loaded. Then it doesn't change anymore..
Any ideas?
__________________
Tanax is offline  
Reply With Quote