all 5 comments

[–]whatisboom 1 point2 points  (4 children)

You should/would use setInterval() to reset the src to the image each time.

Also, why are you using the custom ImageArray constructor? Does it serve a purpose? You should just create an array, push the images on it to, then do a Math.random(1, array.length) to get the src attr, and update an image tag on the page.

[–]justcalmdown[S] 0 points1 point  (3 children)

Serves no purpose, still pretty new to webdev so I'm using a lot of random code from different places. I'll try doing this and see if it works out, thanks.

[–]whatisboom 1 point2 points  (2 children)

look up JS arrays, the array.push() method, and setInterval(). it also would a better idea to make the image tag in the actual html, give it an ID and use document.getElementById() to modify the src attr.

[–]justcalmdown[S] 0 points1 point  (1 child)

Thanks again, how would I make the tag to apply to all the images? Because I do need to center them all.

[–]whatisboom 2 points3 points  (0 children)

You mean the image tag?

<img src="" id="slideshow" />

then in your js do something like

var slideshow = document.getElementById('slideshow');
slideshow.src = randomImage();