Posted by: Randeep Singh | June 5, 2007

Random Link

This example demonstrates a link, when you click on the link it will take you to punjabijunction.com OR to google.com. There is a 50% chance for each of them.

 <html>
<body>

<script type=”text/javascript”>
var r=Math.random()
if (r>0.5)
{
document.write(“<a href=’http://www.punjabijunction.com’>Punjabi Junction</a>”)
}
else
{
document.write(“<a href=’http://www.punjabijunction.com’>Google</a>&#8221;)
}
</script>

</body>
</html>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: