SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru redhillccwebmas's Avatar
    Join Date
    Jun 2005
    Posts
    989
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Banner rotation script BUT allows you to specify time for EACH banner

    Hi there,

    I'm having problems finding a banner rotation script that allows me to assign a different waiting time for each banner.
    I have seen many which stagger the banners by the same time for every banner, but none which are suitable to what I want it to.

    For example, I want to rotate 4 banners - one after 20 seconds, one after 16 seconds, one after 10 seconds and one after 5 seconds

    Can anyone point me in the right direction?

    Kind Regards

    James

  2. #2
    SitePoint Member
    Join Date
    Mar 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You'd be smart to hire a programmer to build you a custom rotator... Then you can have the features you want.

  3. #3
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I gave it a shot because it seems interesting and because I've never used setTimeout() before. I tried this:
    Code:
    <html>
    <head>
    <script type="text/javascript">
    var time = new Array('20','16','10','5');
    var banners = new Array("b1","b2","b3","b4"); 
    window.onload = function() {
    var banner = document.getElementById('bannerlocation');
      for (var i = 0; i < 4; i++) {
        window.setTimeout(document.getElementById('bannerlocation').firstChild.nodeValue =  banners[i], time[i] * 1000);
      }
    }
    </script>
    </head>
    <body>
    <span id="bannerlocation">space</span>
    </body>
    </html>
    But it doesn't work, I get messages in the javascript console saying that b1, b2, b3 and b4 aren't defined (after the specified intervals) even though I'm never claiming they're variables.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •