October 4, 201016 yr Hi, I have a page (http://www.abimagery.co.uk/abimagery-galleries.html) where i want to have random images displayed for each different gallery. I've seen scripts that will do this for a single image location on the page but can't find anything that would solve my problem. Hope someone can help. Cheers Tony
October 4, 201016 yr I think this is the code you want buddy...I use this myself on my website. <script language="JavaScript"><!-- /* Random Image Link Script By Website Abstraction (http://www.wsabstract.com) and Java-scripts.net (http://www.java-scripts.net) */ function random_imglink(){ var myimages=new Array() //specify random images below. You can have as many as you wish myimages[1]="YOURIMAGE1.GIF" myimages[2]="YOURIMAGE2.GIF" myimages[3]="YOURIMAGE3.GIF" //specify corresponding links below var imagelinks=new Array() imagelinks[1]="LINK1" imagelinks[2]="LINK2" imagelinks[3]="LINK3" var ry=Math.floor(Math.random()*myimages.length) if (ry==0) ry=1 document.write('<a href='+'"'+imagelinks[ry]+'"'+'><img src="'+myimages[ry]+'" border=0></a>') } random_imglink() //--> </script>
October 4, 201016 yr Author brilliant thanks for that. i'm presuming i can put this script at whichever location i want the random image to occur or if it has to go in the </head> it won't do what i need.
October 4, 201016 yr No it doesn't have to go into the head I shouldn't think so. Give it a try were you want it and see how it goes.
October 5, 201016 yr Author Sorry, i had to dash away yesterday . . . brilliant i will give it a try today and let you know how i get on cheers Tony
October 5, 201016 yr Author Hi Finnan3, Script works a treat. Really appreciate your help. Cheers Tony
October 5, 201016 yr Hi Finnan3, Script works a treat. Really appreciate your help. Cheers Tony No worries..happy to help.
October 13, 201016 yr i'm bigheaded i can put this script at whichever spot i want the random image to occur or if it has to go in the </head> it won't do what i need.
October 16, 201016 yr I'm adult i can put this script at which ever spot i want the random image to happen or if it has to go in the </head> it won't do what i demand.
Create an account or sign in to comment