"Dave Carrera" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have an array of which shows an image in a place on my page which shows
> the next on the list when the page refreshes, this works fine.
>
> What I want to do is have the image refresh on a 5 second timed interval.
>
> So:
>
> I have a list of images i.e..:
>
> image_1.gif
> image_2.gif
> image_3.gif
>
> Which I want to refresh every 5 seconds

I would suggest using JavaScript for this;
something like

<html>
<head>
    <script language="javascript">
    <!--
        img = 0;
        max_img = 0;
        delay = 5000;    // 5 seconds

        imgnames = new array(
            'image_1.gif',
            'image_2.gif',
            'image_3.gif'
        );
        images = new array();

        function preload() {
            var i = 0;
            for (name in imgnames) {
                images[i] = new Image();
                images[i].src = name;
                i++;
            }
            max_img = i;
        }

        function start() {
            setInterval("replaceImage(document.images[abc])", delay);
        }

        function replaceImage(hImg) {
            if (++img >= max_img)
                img = 0;

            hImg.src = images[img].src;
        }
    -->
    </script>
</head>
<body onload='preload(); start();')>
    <img name='abc' src = 'image_1.gif'>
</body>
</html>

(This is just off the top of my head; it is untested
and probably not cross-browser compatible, but
it should point you in the right direction).



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to