我想在此脚本中添加下一个按钮,而不是按定时间隔更改图像。我会如何去做这件事?将下一个按钮添加到我的幻灯片中
下面是代码:
<script src="viewimages.php"></script>
<script type="text/javascript">
var curimg=0
function rotateimages(){
document.getElementById("slideshow").setAttribute("src", ""+galleryarray[curimg])
curimg=(curimg<galleryarray.length-1)? curimg+1 : 0
}
window.onload=function(){
setInterval("rotateimages()", 4500)
}
</script>
<div style="width: 500px; height: 500px">
<img style="width: 100%; height: 100%;" id="slideshow" src="boston1.JPG" />
</div>