文件是这里使用的数组,并在其中传递了三个项目。在下一个button
后,我只收到array
的第一件物品。如何获得下一个项目onclick
下一个button
?文件列表预览onclick
请找JS代码如下:
function plusSlides(n) {
var i;
var currentIndex= 0;
var files = ["","",""];
if(currentIndex<files.length)
{
var omyFrame = document.getElementById("myFrame");
omyFrame.style.display="block";
omyFrame.src = files[currentIndex];
currentIndex++;
}
n++;
}
我认为你的代码片段没有提供足够的上下文。下一个按钮在哪里?请点击下一个按钮调用'plusSlides'? –
将'if'改为'while'。另外,变量'i'和'n'是无用的 –
将'if'改为'while'将在每次调用时设置iframe源三次,iframe将始终具有文件中最后一项的ssrc。 –