I'm doing an automatic slider and in chrome it works for me but in mozilla and opera no image comes out. With this I rule out that I am calling the document wrong but I can not see the error, can you help me?
window.addEventListener('load', function (){
var imagenes = [];
imagenes[0] = '../Imagenes/slider1.jpg';
imagenes[1] = '../Imagenes/slider2.jpg';
imagenes[2] = '../Imagenes/slider3.jpg';
var long_imagenes = imagenes.length;
var cnt = 0;
function cambiarImagenes(){
document.img_slider.src = imagenes[cnt];
if(cnt < (long_imagenes-1)){
cnt = cnt +1;
}else{
cnt = 0;
}
}
setInterval(cambiarImagenes,3000);
});
<div id="slider_cont">
<img name="img_slider" id="img_slider">
</div>
EDITO Thanks to the comments so far I think the error is in the route, because if I put the links there is the snippet if it works.
My root:
What I do is leave the folder js, enter images and define the image I want to take.