Random Image and Link

[Total: 0    Average: 0/5]

This shows how to have an image and a link over it both created randomly.

Body Code:

<script language="JavaScript">
<!-- Hide from old browsers

var imagenumber = 5 ;
var randomnumber = Math.random() ;
var rand1 = Math.round( (imagenumber-1) * randomnumber) + 1 ;
images = new Array
images[1] = "/js/pic1.gif"
images[2] = "/js/pic2.gif"
images[3] = "/js/pic3.gif"
images[4] = "/js/pic4.gif"
images[5] = "/js/pic1.gif"
var image = images[rand1]

links = new Array
links[1] = "/"
links[2] = "/"
links[3] = "/"
links[4] = "/"
links[5] = "/"
var link = links[rand1]
// -- End Hiding Here -->

</script>


<script language="JavaScript">
<!-- Hide this script from old browsers -->
document.write("<center><b>Reload this page</b></center><br><br>")
document.write('<A HREF="' + link + '"><IMG SRC="' + image + '" border="0"></a>')
<!-- End Hiding Here -->
</script>

Times Viewed: 1

Leave a Reply

Your email address will not be published. Required fields are marked *