How to show a new image every x seconds?
<p>Trying to do a set Interval timer using JavaScript, I'm not sure how to put images in a array.<br>
I have tried several different ways but can't get it to work.</p>

<pre><code>var myImage = document.getElementById("mainImage");

var imageArray = [img class="irc_mi ix3z7xWjrSdc-pQOPx8XEepE" alt="Image result for baseball images" style="margin-top: 70px;" src="http://totalsportscomplex.com/wp-content/uploads/2014/09/baseball-pic.jpg" onload="google.aft&amp;amp;&amp;amp;google.aft(this)" width="626" height="415",
img class="irc_mi ix3z7xWjrSdc-pQOPx8XEepE" alt="Image result for baseball images" style="margin-top: 70px;" src="http://totalsportscomplex.com/wp-content/uploads/2014/09/baseball-pic.jpg" onload="google.aft&amp;amp;&amp;amp;google.aft(this)" width="626" height="415",
img class="irc_mi ix3z7xWjrSdc-pQOPx8XEepE" alt="Image result for baseball images" style="margin-top: 70px;" src="http://totalsportscomplex.com/wp-content/uploads/2014/09/baseball-pic.jpg" onload="google.aft&amp;amp;&amp;amp;google.aft(this)" width="626" height="415"]

var imageIndex = 0;

function changeImage() {
    myImage.setAttribute("src",imageArray[imageIndex]);
  imageIndex++;
  if(imageIndex &gt;= imageArray.length) {
  indexImage = 0;
  }
}

setInterval(changeImage,5000);
</code></pre>

<p>thanks in advance, also I'm new and did try to look for an answer but could not find one.</p>