Hi could someone please help?... I am a total beginner to javascript... but does anyone know of a code, including links to an image folder, for displaying 6 fullscreen images in random order without repeat for a given user?
I've seen specific examples using shuffle on the site, but could anyone write a general code for any given images?
This may be your answer. Your feedback is appreciated.
Code:
<script language="JavaScript">
function random_imglink(){
var myimages=new Array()
myimages[1]="banner_01.jpg"
myimages[2]="banner_02.jpg"
myimages[3]="banner_03.jpg"
var imagelinks=new Array()
imagelinks[1]="http://www.url-link01.com"
imagelinks[2]="http://www.url-link02.com"
imagelinks[3]="http://www.url-link03.com"
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>
Generating random picture including it's own link each time the page refreshed. But I want something that when I click the image, it opened new page / tab / window, just like when you click outside link from this forum.
thanks,
Chrish Hardwick
Users who have thanked ChrishHardwick for this post:
Hi is it possible to load images to fullscreen for the above random image generator script?
I noticed that the images being rejected in the random selection process are still visible as frames on the screen, which is kind of ugly. Is there any way to prevent them being visible until the actual image is randomly selected?
Also the above script doesn't seem to end when the main script loads. Is it possible to do that?