我提出了一个问题,在我自己的灯塔中设置一个限制。
<script>
var imagenumber = 0;
function btnleft(){
load = imagenumber-=1;
document.getElementById( lightboxcontent ).innerHTML=imagelist[load];
}
function btnright(){
load = imagenumber+=1;
if (load==undefined){load=imagenumber-=1}
document.getElementById( lightboxcontent ).innerHTML=imagelist[load];
}
</script>
然后是阵列
var imagelist=new Array(); // regular array (add an optional integer
imagelist[0]="image1.jpg"; // argument to control array s size)
imagelist[1]="image2.jpg";
imagelist[2]="image3.jpg";
When I click more then 3 times on the next button I got the error-message "undefined". How should I do to get a limit on my arrays?