title: How can I make a form selection open in a new tab?
body: <p>I found this script in a previous search for a way to submit a url from a radio button to the browser:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script type="text/javascript"&gt;
  
    function doSubmit(form) {
      var urls = form['url'];
      var i = urls &amp;&amp; urls.length;
      while (i--) {
        if (urls[i].checked) {
          window.location = urls[i].value;
        }
      }
      return false;
    }
  
    &lt;/script&gt;
  
    &lt;form action="" onsubmit="return doSubmit(this)"&gt;
      &lt;input type="radio" name="url" value="http://www.google.com"&gt; Google
      &lt;input type="radio" name="url" value="http://www.yahoo.com"&gt; Yahoo
      &lt;input type="submit" value="Submit"&gt;
    &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>What I'm trying to do is modify the script so that it opens the url in a new tab. I've tried adding the '_blank' parameter with no luck, but I'm not even 100% sure where it would go. Has anybody got an answer for me?</p>