SimplePortal

Customization => Custom Coding => Topic started by: 420connect on December 13, 2015, 10:31:19 AM

Title: Rotating linked images
Post by: 420connect on December 13, 2015, 10:31:19 AM
Hey,

I'm trying to use this in a HTML block, but when I hit preview, I see nothing? though when I preview it elsewhere it works as intended?

Code: [Select]
<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="example1.html"><img src="http://www.420connect.co.uk/vault.gif"></a>';
random_img[1] = '<a href="example1.html"><img src="http://www.420connect.co.uk/vault2.gif"></a>';
random_img[2] = '<a href="example1.html"><img src="http://www.420connect.co.uk/vault3.gif"></a>';
document.write(random_img[random_number]);
</script>
Title: Re: Rotating linked images
Post by: Chen Zhen on December 13, 2015, 07:17:20 PM
This works for me although image 2 & 3 do not currently exist on your server as the code implies.
 
SimplePortal 2.3.8 © 2008-2024, SimplePortal