1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| <div id="banner"></div>
<script>
var nBanDelais = 10;
var aBannieres = new Array();
aBannieres[0] = new twBanniere('http://www.1site.com','http://www.1site/image1.jpg','');
aBannieres[1] = new twBanniere('http://www.2site.com','http://www.2site/image2.jpg','');
aBanLien = document.createElement('a');
aBanLien.target = '_blank';
aBanLien.href='#';
aBanImg = document.createElement('img');
aBanImg.alt = 'Chargement...';
aBanImg.border = 0;
aBanImg.src = 'http://www.site3.com/pub/publicite.jpg';
document.getElementById().appendChild(aBanLien);
aBanLien.appendChild(aBanImg);
function twBanniere(_url, _src, _texte) {
this.url=_url;
this.src=_src;
this.texte=_texte;
}
function twRotation () {
nBanPos++;
if (nBanPos >= aBannieres.length)
nBanPos = 0;
twSetCurrentBan(nBanPos);
setTimeout('twRotation();', nBanDelais * 1000);
}
function twSetCurrentBan(n) {
aBanImg.src = aBannieres[n].src;
aBanImg.title = aBannieres[n].texte;
aBanLien.href = aBannieres[n].url;
}
twRotation();
</script> |
Partager