repeating function with time
<p>I am trying to display sports scores every 90 seconds in an iframe. I have everything working except for one part. The issue I have is that once the time goes from 90 to 0 it loads the html page into and iframe and continues to reload the same html page forever. How can I make it load one time, and then start the 90 second countdown over again?</p>

<pre><code>// variables
var timeCountdown = 90,
  minutesCountdown,
  secondsCountdown,
  mainCountdown;
// main script countdown
mainCountdown = setInterval(function() {
  // display countdown time
  document.getElementById("countdown").innerText = mainCountdown + " seconds remaining!";
  // if time is 0 or smaller
  if (timeCountdown &lt;= 0) {
        // load sports scores
        document.getElementById("iframe").src = "sports/nba/feed.html";
  } else {
        // convert random time to minutes
        minutesCountdown= Math.floor(timeCountdown / 60);
        //  convert random time to seconds
        secondsCountdown = (timeCountdown % 60);
        // add leading zero to seconds if less than ten
        if (secondsCountdown &lt; 10) {
        secondsCountdown = "0" + secondsCountdown;
        }
        // add leading zero to minutes if less than ten
        if (minutesCountdown &lt;= 10) {
        minutesCountdown = "0" + minutesCountdown;
        }
        // display countdown until next search
        document.getElementById("countdown").innerHTML = "Loading NBA scores in " + minutesCountdown + ':' + secondsCountdown;
        // reduce countdown time
        timeCountdown--;
  }
}, 1000);
</code></pre>
