You can accomplish it with just JavaScript too

<script language="javascript">

                        
                        //Set variables
                        var myInt;
                        var counter = 0;
                        //Speed between between each image 5000 would
be 5 seconds
                        var speed = 5000;
                        var images = new Array(6);
                        
                        //Populate array                                

                        images[0] = "<a href = 'page1.html'><img 
src='../images/image1.png'
alt=''></a>";
                        images[1] = "<a href = 'page2.html'><img 
src='../images/image2.png'
alt=''></a>";

                        images[2] = "<a href = 'page3.html'><img 
src='../images/image3.png'
alt=''></a>";
                        images[3] = "<a href = 'page4.html'><img 
src='../images/image4.png'
alt=''></a>";

                        images[4] = "<a href = 'page5.html'><img 
src='../images/image5.png'
alt=''></a>";
                        images[5] = "<a href = 'page6.html'><img 
src='../images/image6.png'
alt=''></a>";

                        
                        //load the first images into the browser
                        document.write(images[0]);
                        
                        //Function to load images into browser window
                        function loadImage(){
                        
                                //Increment the counter
                                counter++;

                                
                                //If the counter value is greater than total 
images, then reset
the counter value
                                if(counter >= images.length){
                                        counter = 0;
                                }
                                
                                //Load the images array elements value into the 
mainContent area

                                
document.getElementById('mainContent').innerHTML = images[counter];

                        }
                        
                        //Set and begin the timer
                        setInterval("loadImage()",speed);
                        
       </script>



Zach Schneider

http://www.twitter.com/zkm
http://www.zachschneider.com
http://www.linkedin.com/in/zschneider


Jonathan Swift<http://www.brainyquote.com/quotes/authors/j/jonathan_swift.html>
- "May you live every day of your life."

On Thu, Oct 15, 2009 at 4:55 AM, Martin <[email protected]>wrote:

> You could use jquery to change the styles of the corresponding elements on
> load...
>
> 2009/10/15 [email protected] <[email protected]>
>
>
>> Hi,
>>
>> I would like to display a new image/banner everytime the page is
>> refreshed...something similar to www.dabs.com
>>
>> Dabs not only has a new image on each reload but the background also
>> changes in relation to which image is shown - how can I do this?  I've
>> looked at Dabs code but can't really work it out...can anybody help
>> me?
>>
>> Thanks.
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
--
You received this because you are subscribed to the "Design the Web with CSS" 
at Google groups.
To post: [email protected]
To unsubscribe: [email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to