Random Link

A simple random link generator where the location of the link is chosen at random when the page loads.

<a href=" " target="_blank" >Random Link</a>

<script type="text/javascript">
<!--

urlArray=new Array()
urlArray[1]=new Array("http://www.hrgiger.com","HR Giger")
urlArray[2]=new Array("http://www.joecartoon.com","JoeCartoon")
urlArray[3]=new Array("http://www.bravenet.com","Bravenet")
urlArray[4]=new Array("http://www.webreference.com","Webreference")
urlArray[5]=new Array("http://www.dhtmlnirvana.com","DHTML Nirvana")
urlArray[6]=new Array("http://www.codingforums.com","CodingForums")
urlArray[7]=new Array("http://www.pcplus.co.uk","PC Plus")
urlArray[8]=new Array("http://www.netmag.co.uk","Netmag")

function showLink(){
num=Math.floor(Math.random()*urlArray.length)
document.getElementById("lnk1").href=urlArray[num][0]
document.getElementById("lnk1").title=urlArray[num][1]
document.getElementById("lnk1").innerHTML=urlArray[num][1]
}

// add  onload="showLink()" to the opening BODY tag

//-->
</script>

<a id="lnk1" href="#null">Random Link</a>

You could also have the link randomly change each time it is clicked by adding onclick="showLink();return;false" to the link code

With the above script even though the link is selected at random it is still possible for the same link to be chosen consecutively.
For a solution to this see Random Links in my cookie section.