Cut & Paste Random Link Generator by JavaScript Team

By JavaScript Team on Mar 25, 2012


Random Link Script, randomly chooses between a custom list of url’s


This JavaScript will generate a random url by clicking on it. The script that will randomly choose between a specified pool of urls that you customize. The user will be redirected to that url after pressing the button.

Code Snippet

<script> <!-- /* Random link button- By JavaScript Kit ( Over 300+ free scripts! This credit MUST stay intact for use */  //specify random links below. You can have as many as you want var randomlinks=new Array()  randomlinks[0]="" randomlinks[1]="" randomlinks[2]="" randomlinks[3]="" randomlinks[4]=""  function randomlink(){ window.location=randomlinks[Math.floor(Math.random()*randomlinks.length)] } //--> </script> <form> <p><input type="button" name="B1" value="Random Link >>" onclick="randomlink()"></p> </form>  <!--Uncomment below to use a regular text link instead <a href="javascript:randomlink()">Random Link</a> -->