views:

20

answers:

1

I have this banner rotator function:

var banners = ['../Graphics/adv/1.gif','../Graphics/adv/2.jpg']; //here put location of the files to display
var loadedImgSrc = null;

function loadBanner() {
  var liczba = Math.floor(Math.random()*banners.length);
  loadedImgSrc = banners[liczba];
  var objImage = new Image();
  objImage.onLoad=imagesLoaded();
  objImage.src = banners[liczba];
}

function imagesLoaded() {
  document.getElementById('ad_banner').src = loadedImgSrc;
  startRotator();
}

function startRotator() {
  setTimeout('loadBanner()',8000); //here, set up interval in miliseconds 1000ms -> 1s
}

This is giving a "loading" message, as if the browsers are continuously loading.

Does anybody have a simple banner-rotator to share?

Or does anybody know whats wrong with this one?

Thanks

A: 

Take a look at this custom animated banner made with jQuery. There are both horizontal and vertical versions.

Sarfraz