Last active
May 8, 2019 15:06
-
-
Save mattmorgis/2c4bd1f7d2ca7f318e2a to your computer and use it in GitHub Desktop.
Display Random Ad (WordPress or HTML)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
var total_images = 3; | |
var random_number = Math.floor((Math.random()*total_images)); | |
var random_img = new Array(); | |
random_img[0] = '<a href="http://google.com"><img src="http://domain.com/images/ad1.gif"></a>'; | |
random_img[1] = '<a href="http://google.com"><img src="http://domain.com/images/ad2.gif"></a>'; | |
random_img[2] = '<a href="http://google.com"><img src="http://domain.com/images/ad3.gif"></a>'; | |
document.write(random_img[random_number]); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment