创建手动幻灯片时出错
2017-06-20
41
出于某种原因,我在JavaScript文件中的一条行上不断遇到以下错误(我在下面指出的行)。这是我的html:
019730692
和我的javascript:
229637713
出于某种原因, “堵塞”;”在脚本的最后一行中,遇到了错误:
163536598
javascript行68是最终封闭的卷曲括号和html中的第42行之前的最后一行,是“ rightbutton”线(html复制的第二行)
谢谢您的所有帮助和时间。
2个回答
查看您的代码,我发现从 Html 文件调用“manualslideshow”方法时出现错误。(即第 42 行)。 请参见下面的代码。我已将 ("rightbutton,projectslides1") 更改为 ("rightbutton","projectslides1")
<div class="slideshowproject">
<button id="rightbutton" onclick=manualslideshow("rightbutton","projectslides1")>></button>
<img class="projectslides1" src="Project Images\\HarrisonHealthClinic\\Render 1-1.jpg">
<img class="projectslides1" src="Project Images\\HarrisonHealthClinic\\Render 2-1.jpg">
<img class="projectslides1" src="Project Images\\HarrisonHealthClinic\\Render 3-1.jpg">
<button id="leftbutton" onclick=manualslideshow("leftbutton","projectslides1")><</button>
<script>manualslideshow("","projectslides1")</script>
</div>
Raj
2017-06-20
您在调用 manualslideshow 函数时出现了一些错误:
var imagenumber=0;
function manualslideshow(buttonid,slideshowclass){
var pictures=document.getElementsByClassName(slideshowclass);
for (i=0;i<pictures.length;i++){
pictures[i].style.display="none";
}
if (buttonid=="rightbutton"){
imagenumber++;
}
else if (buttonid=="leftbutton"){
imagenumber--;
}
if (imagenumber>pictures.length){
imagenumber=1;
}
if (imagenumber<1){
imagenumber=pictures.length;
}
pictures[imagenumber-1].style.display="block";
}
manualslideshow("","projectslides1")
<div class="slideshowproject">
<button id="rightbutton" onclick=manualslideshow("rightbutton","projectslides1")>></button>
<img class="projectslides1" src="Project Images\\HarrisonHealthClinic\\Render 1-1.jpg">
<img class="projectslides1" src="Project Images\\HarrisonHealthClinic\\Render 2-1.jpg">
<img class="projectslides1" src="Project Images\\HarrisonHealthClinic\\Render 3-1.jpg">
<button id="leftbutton" onclick=manualslideshow("leftbutton","projectslides1")><</button>
</div>
Govind Samrow
2017-06-20