我对javascript很陌生。以下代码工作正常。当我单击“下一步”按钮时,幻灯片会停止它应该怎么做,但是当单击显示上一张图片时,它只显示一张图片并停止?我不明白出了什么问题。请帮帮我
window.onload = function () {
newImg = new Array("images/image1.jpg", "images/image2.jpg", "images/image3.jpg", "images/image4.jpg");
var iImage = 1;
var imgTimer = new Timer();
imgTimer.Interval = 5000;
imgTimer.Tick = function () {
document.slideshow.src = newImg[iImage];
iImage++
if (iImage >= newImg.length) {
iImage = 0;
}
document.getElementById('next').onclick = function () {
if (iImage < newImg.length) {
document.slideshow.src = newImg[iImage];
iImage++
if (iImage = newImg.length) {
iImage = 0;
}
}
imgTimer.Stop();
}
document.getElementById('prev').onclick = function () {
if (iImage > 0) {
document.slideshow.src = newImg[iImage];
iImage--
if (iImage = 0) {
iImage = newImg.length;
}
}
imgTimer.Stop();
}
};
imgTimer.Start();
};