<div class="klasa" ID="slideshow"></div>
oraz przy znaczniku body
<body onload="show('pic',5);" >
ustawienie co 5 sek zmiany wyświetlanych obrazówKod javascript
var nPic = 0;
var tab_pic = new Array(7);
tab_pic[0]="pic/pic1.jpg";
tab_pic[1]="pic/pic2.jpg";
tab_pic[2]="pic/pic3.jpg";
tab_pic[3]="pic/pic4.jpg";
tab_pic[4]="pic/pic5.jpg";
tab_pic[5]="pic/pic6.jpg";
tab_pic[6]="pic/pic7.png";
function show(nId,nSec){
window.setInterval('nPic = slideshow("'+nId+'",nPic)',(nSec*1000));
}
function slideshow(nId,nPic)
{
if (document.getElementById(nId)) {
var div = document.getElementById(nId);
if (IsIE()) {
div.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + tab_pic[nPic] + '",sizingMethod="crop")';
} else {
div.style.backgroundImage = 'url(' + tab_pic[nPic] + ')';
}
}
if (nPic < tab_pic.length - 1) nPic = nPic + 1; else nPic = 0;
return nPic;
}
Brak komentarzy:
Prześlij komentarz