The title basically says it all.
I am trying to change an image to a random image from an array of images (hope that makes sense lol).
How can I create an array of images and then have the img change when something is clicked?
<h1>These are just placeholders</h1>
<p>I just want these images to randomly change to an image from an array of images each time they are shown (when "display" isn't "none")</p>
<img src="http://ift.tt/2ee6V7v" class="newsAD"></img>
<img src="http://ift.tt/2eBF6UO" class="newsAD"></img>
<style>
.newsAD {
width: 150px;
height: 150px;
margin-left: 50px;
background: skyblue;
cursor: default;
box-shadow: 1px 2px 5px 1px rgba(0, 0, 0, 0.4);
}
</style>
Aucun commentaire:
Enregistrer un commentaire