title: How do I make a HTML button open in random links in new tab
body: <p>So I am creating a uselesswebsite and I need to make a button that directs people to random websites in new tabs. I already have the random link button code but I cant seem to add it with the new tab code.</p>
  
  <p>sample</p>
  
  <pre><code>var randomlinks=new Array(10)
  
   randomlinks[0]="http://ducksarethebest.com/"
   randomlinks[1]="http://cant-not-tweet-this.com/"
   randomlinks[2]="http://just-shower-thoughts.tumblr.com/"
   randomlinks[3]="http://www.fallingfalling.com/"
   randomlinks[4]="http://www.partridgegetslucky.com/"
   randomlinks[5]="http://ducksarethebest.com/"
   randomlinks[6]="http://cant-not-tweet-this.com/"
   randomlinks[7]="http://just-shower-thoughts.tumblr.com/"
   randomlinks[8]="http://www.fallingfalling.com/"
   randomlinks[9]="http://www.staggeringbeauty.com/"
   randomlinks[10]="http://www.trypap.com/"
  
  function randomlink(){
  window.location=randomlinks[Math.floor(Math.random()*randomlinks.length)]
  }
  </code></pre>
  
  <p>Html</p>
  
  <pre><code>    &lt;form method="post"&gt;
      &lt;p&gt;&lt;input type="button" name="B1" value="Random Link &gt;&gt;" onclick="randomlink()""window.open'"&gt;&lt;/p&gt; 
  &lt;/form&gt;
      or
      &lt;a href="javascript:randomlink()"&gt;Random Link&lt;/a&gt;
  </code></pre>