I'm trying to get a page to display a series of images, one at a time, and changing the display every
n seconds.
I wrote a php routine "rotatepix.php." Using that script I can open the directory and randomly select and display an image. However, php stops as soon as the page is loaded. With each refresh (or opening) of the page, a randomly-selected image displays.
But I want to have javascript take over and keep changing the images.
I think the approach is to use setInterval() to call the php script
Code:
function foo()
{
var action;
action="document.open('rotatepix.php')";
setInterval(action, 500);
}
foo();
and then call that script from the web page. With that I don't get any errors, but I also don't get any results.
As you can see, my js skills suck.
I've looked at some "rotating banners" code, but none seem to fit what I need.
Some notes:
- all of the images are in the same directory
- all of the server side action takes place on the same server, and that server supports php
- the rotatepix.php mentioned above works within PHP's limitations
Can someone get me on the right track? I'd be happy to omit the php if there's a simple js that will accomplish the same goal: pictures selected at random, displayed, and display changed every
n seconds