Open multiple links with one click
<p>I am trying to open multiple links with one click. This is what I did so far. I have little knowledge about JavaScript.</p>

<p>It's a simple example to show some links. I want the links to open in new tabs so the first thing I did worked, but the other function about clicking a button to open all links doesn't work for me. Here's what I did so far:</p>

<pre><code>&lt;html&gt;
  &lt;head&gt;
    &lt;base target='_blank' /&gt;
    &lt;script type='text/javascript'&gt;
      // opening links in new tab
      var ver = parseFloat(navigator.appVersion);
      var ver2 = (navigator.userAgent.indexOf("Windows 95") &gt;= 0 ||
        navigator.userAgent.indexOf("Windows 98") &gt;= 0 ||
        navigator.userAgent.indexOf("Windows NT") &gt;= 0) &amp;&amp;
        (navigator.userAgent.indexOf('Opera') == -1) &amp;&amp;
        (navigator.appName != 'Netscape') &amp;&amp;
        (navigator.userAgent.indexOf('MSIE') &gt; -1) &amp;&amp;
        (navigator.userAgent.indexOf('SV1') &gt; -1) &amp;&amp;
        (ver &gt;= 4);
      if (ver2) {
        if (document.links) {
          for (var d = 0; d &lt; document.links.length; d++) {
            if (document.links[d].target != "_blank") {
              document.links[d].onclick_copy = document.links[d].onclick;
              document.links[d].onclick = function(){showhide('div1')};
            }
          }
        }
      }
      document.onclick_copy = document.onclick;
      document.onmouseup = function(){showhide('div1')};
      // this function should loop and click links one by one with a 10 sec delay
      var span = document.getElementsByTagName("span")[3];
      var i = 0;
      (function looper() {
        if( i++ &lt; 100 ) {
          onClick="document.getElementById('i').click()"
          setTimeout( looper, 10000);
        }
      })();
    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;// links in body of the html page
    &lt;a id="1" href="url1/"&gt;&lt;/a&gt;&lt;br&gt;
    &lt;a id="2" href="url2/"&gt;&lt;/a&gt;&lt;br&gt;
    &lt;a id="3" href="url3/"&gt;&lt;/a&gt;&lt;br&gt;
    &lt;a id="4" href="url4/"&gt;&lt;/a&gt;&lt;br&gt;
    &lt;a id="5" href="url5/"&gt;&lt;/a&gt;&lt;br&gt;
    &lt;a id="6" href="url6/"&gt;&lt;/a&gt;&lt;br&gt;
    &lt;a id="7" href="url7/"&gt;&lt;/a&gt;&lt;br&gt;
    &lt;a id="8" href="url8/"&gt;&lt;/a&gt;&lt;br&gt;
    &lt;a id="9" href="url9/"&gt;&lt;/a&gt;&lt;br&gt;
    &lt;button onClick="document.getElementById('i').click()"&gt;open all links&lt;/button&gt;
    // when click a button should open all links.
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>I even tried:</p>

<pre><code>$('a[href*="/steve"]').each(function(index) {
  setTimeout(
    function(href){window.open(href)},
    (index+1)*5000, $(this).attr('href')
  );
});
</code></pre>

<p>Any help appreciated.</p>
