将幻灯片更改为按点击播放,而不是基于时间播放

时间:2018-09-20 22:04:43

标签: javascript slideshow

我正在制作幻灯片,如何更改此幻灯片的javascript代码,以便仅在用户单击时更改图像

预先感谢

<script language="javascript" type="text/javascript">
var slideShowSpeed = 5000;
var crossFadeDuration = 3;
var Pic = new Array();

Pic[0] = 'images/slide-03.jpg'
Pic[1] = 'images/slide-04.jpg'
Pic[2] = 'images/slide-05.jpg'


var t;
var j = 0;
var p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
preLoad[i] = new Image();
preLoad[i].src = Pic[i];
}
function runSlideShow() {
if (document.all) {
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = preLoad[j].src;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShow()', slideShowSpeed);
}
window.onload=runSlideShow;
</script>

0 个答案:

没有答案