Randomiser code

View previous topic View next topic Go down

Randomiser code

Post by fawnlemur on Mon Jan 05, 2015 4:45 pm

<div id="randimg" style="width:float;">


<SCRIPT LANGUAGE="Javascript">
function banner() { } ; b = new banner() ; n = 0
b[n++]= "<A HREF='http://padrewa.com/' ><IMG name=randimg SRC='https://farm8.staticflickr.com/7300/9267502045_182099af29_b.jpg' border='0' ALT='Banner1'></A>"

b[n++]= "<A HREF='http://padrewa.com/'><IMG name=randimg SRC='https://farm3.staticflickr.com/2812/9270288754_d406240412_b.jpg' border='0' ALT='Banner2'></A>"

b[n++]= "<A HREF='http://padrewa.com/'><IMG name=randimg SRC='https://farm6.staticflickr.com/5329/9267511917_22077a0905_b.jpg' border='0' ALT='Banner2'></A>"

b[n++]= "<A HREF='http://padrewa.com/'><IMG name=randimg SRC='https://farm3.staticflickr.com/2835/9270308346_1ecdaa2fbe_b.jpg' border='0' ALT='Banner2'></A>"

b[n++]= "<A HREF='http://padrewa.com/'><IMG name=randimg SRC='https://farm6.staticflickr.com/5335/9270302010_8f7c1ffd53_b.jpg' border='0' ALT='Banner3'></A>"
i=Math.floor(Math.random() * n) ;
document.write( b[i] )
</SCRIPT>
</div>
avatar
fawnlemur

Posts : 1
Join date : 2014-12-24

Back to top Go down

Re: Randomiser code

Post by Smakx on Tue Jan 06, 2015 3:01 am

Thanks for this. I've used it as the basis of the new "Random Card" widget, loading a new random card on page load. This replaces the previous widget which utilized some heavy script and off-site resources that were inconsistent, resulting in intermittently slow loading pages. With the new script, everything is nice and zippy as it should be. Thanks again, see you in chat for some Star Realms Smile
avatar
Smakx
Admin

Posts : 303
Join date : 2014-10-25

http://realmchat.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum