title: Open Checkbox multiple tabs on submit
body: <p>I am an absolute beginner when it comes to anything JavaScript or JQuery. I am trying to get a few checkboxes open in a new tab if they are checked and then the submit button clicked. The code I have works only if one checkbox is checked. If more than one is checked, then only the first one is open in the tab. My code is as follows:</p>
  
  <p>Javascript</p>
  
  <pre><code>function CheckCheckboxes(form)
  {
  var
      i, counter = 0;
  
  for (i = 0; i &lt; form.elements.length; ++i) {
      if ('checkbox' === form.elements[i].type &amp;&amp; form.elements[i].checked) {++counter;
          window.open('http://' + form.elements[i].value, '_blank');
      }
  }
  if (!counter) {
      alert('Please check at least one!');
  }
  }
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;form onsubmit="CheckCheckboxes(this); return false;"&gt;
  &lt;table align="left" border="1" style="border-collapse: collapse;"&gt;
  
  &lt;tr style="height:30px"&gt;
      &lt;td colspan="8"&gt;&lt;center&gt;Companies&lt;/center&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;
       &lt;td&gt;&lt;input type="checkbox" name="Google" value="www.google.com" /&gt;Google&lt;/td&gt;
       &lt;td&gt;&lt;input type="checkbox" name="Apple" value="www.apple.com" /&gt;Apple&lt;/td&gt;
       &lt;td&gt;&lt;input type="checkbox" name="Microsoft" value="www.Microsoft.com" /&gt;Microsoft&lt;/td&gt;
       &lt;td&gt;&lt;input type="checkbox" name="facebook" value="www.facebook.com" /&gt;Facebook&lt;/td&gt;
  
   &lt;td&gt;&lt;br /&gt;&lt;input type="submit" value="Send Form" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Any help would be greatly appreciated. Been at this for 3 and a half hours :)</p>
  
  <p>Thanks</p>