hi im new to using javascript and im stuck in a problem. so i have this folder which contains image that i need to diplay and i was using javascript to show these images. every images is named as Slidex.PNG where x is the number of slide. what i have so far is
var baseUrl = "{{ asset($chkdir) }}/";
alert(baseUrl);
var pictureIndex = 1;
function next()
{
var image_url = baseUrl + 'Slide' + pictureIndex + '.PNG';
document.getElementById("viewer").src = image_url ;
pictureIndex++;
}
it is working so far but my problem is say for example i have 5 images inside the folder after the Slide5.PNG it still loads Slide6.PNG which displays a broken image i just wanted to know if there is a way to get the total number of image files inside the folder. Any advices? thanks in advance!