Javascript random image display script

By November 11, 2011 JavaScript
Copy following code and past into your page and change image name only.


<script type=”text/javascript” language=”javascript”>

function randomads() {

var ads = new Array();
im[0] = “image1.gif”;
im[1] = “image2.gif”;

var adlinks = new Array();
links[0] = “http://www.webin2.com”;
links[1] = “http://www.webinsolution.com”;

randnum=Math.floor(Math.random()*ads.length);

document.write(“<a href=” +links[randnum]+ ” target=_blank>
<img src=” +im[randnum]+ ” border=0></a>”)
}

finished
</script>

Leave a Reply

7 + 1 =