This function is very similar to the jQuery setTimeout() Function.
Basic setInterval() Example
// Do something every 5 seconds
Tips: If your changing images dynamically load variables from a PHP script you will need to add some sort of random number to the script so that it forces a refresh in all browsers. You can do this by using the following code to generate a random number.
var refreshId = setInterval( function()
var r = (-0.5)+(Math.random()*(1000.99));
Tips: You might also have to use the ajax method instead of load, to prevent the AJAX request to be cached.
Tips: Alternatively, you could stick header(“Cache-Control: no-cache, must-revalidate”); towards the top of your random.php file to prevent the browser from caching.