title: Autoclick links on webpage for display
body: <p>I have a webpage with 7 links that I want to be able to set to auto click through automatically then repeat forever on toggle with a 60 second delay between clicks.  I'd like to set a button to toggle this on/off.  When toggled on, the webpage would perform the click action, when toggled off, the webpage would behave normally.  The idea is to have this feature for display purposes (displaying our various metrics, etc).  </p>
  
  <p>I found this link which describes using setInterval: <a href="https://stackoverflow.com/questions/3138756/calling-a-function-every-60-seconds">Calling a function every 60 seconds</a></p>
  
  <p>And this one that describes clicking a link programmatically: <a href="https://stackoverflow.com/questions/902713/how-do-i-programmatically-click-a-link-with-javascript">How do I programmatically click a link with javascript?</a>
  , but haven't been able to find any examples of these two methods combined.</p>
  
  <p>Tried:</p>
  
  <pre><code>function click_links(){
      $("safety").trigger("click");
  }
  
  window.setInterval(function(){
  
        click_links();
  }, 2000); 
  </code></pre>
  
  <p>And called with:</p>
  
  <pre><code>onclick="click_links();"
  </code></pre>
  
  <p>But, so far, can't even trigger a click event.</p>
  
  <p>ATTEMPT 2:
  I'm close with this:</p>
  
  <pre><code>function links() {
  safety
  daily
  monday
  tuesday
  }
  
  var intervalId;
  function toggleIntervalb() {
  
    if (!intervalId) {
      intervalId = setTimeout(links, 5000); 
    } else {
      clearInterval(intervalId);
      intervalId = null;
    }
  }
  
  function safety(){
  document.getElementById("fires").style.display = 'none';
  document.getElementById("safety").style.display = 'block';
  document.getElementById("daily").style.display = 'none';
  document.getElementById("monday").style.display = 'none';
  document.getElementById("tuesday").style.display = 'none';
  
  }
  function daily(){
  document.getElementById("fires").style.display = 'none';
  document.getElementById("safety").style.display = 'none';
  document.getElementById("daily").style.display = 'block';
  document.getElementById("monday").style.display = 'none';
  document.getElementById("tuesday").style.display = 'none';
  
  }
  function monday(){
  document.getElementById("fires").style.display = 'none';
  document.getElementById("safety").style.display = 'none';
  document.getElementById("daily").style.display = 'none';
  document.getElementById("monday").style.display = 'block';
  document.getElementById("tuesday").style.display = 'none';
  
  function tuesday(){
  document.getElementById("fires").style.display = 'none';
  document.getElementById("safety").style.display = 'none';
  document.getElementById("daily").style.display = 'none';
  document.getElementById("monday").style.display = 'none';
  document.getElementById("tuesday").style.display = 'block';
  </code></pre>
  
  <p>But, after 5 seconds, it only just executes the last function in the set (tuesday) and does not iterate through them with a delay between each.</p>