Test Index   ·   Photo Borders   ·   Table of sliced images - Rounded corners   ·   Sliced images and manually linked   ·   Overlap Images   ·   Create a Watermark   ·   Gif Png Transparency   ·   Buttons-Image Links   ·   Image Names   ·   Image Theft   ·   Lake Applet   ·   Other applets   ·   Slideshow1   ·   Slideshow2   ·   Slideshow3   ·   Galleries   ·   DD Thumbnail Viewer   ·   image map   ·   xara thumbnail   ·   Random Image   ·   LOGO BRANDING   ·   Animated Image   ·   photo with sound

Random Image on Reload
2 code versions (and 1 variation)

SAMPLE 1:

Reload the page
to see the image change

This one is just images
with NO links.

Want a code that allows
you to link the image to another page?
(or scroll down to view)



Modified script to work in CSB and Trellix shown below.
(visit CMG site by Curtis.  He has the original script and many others!!!  

Place this script into an Insert > HTML (webgem in Trellix). Include the images in the webcomponent.
Change RED item to your image name.
To capture the code, press Select All then COPY the contents.
MUST change each gEMDIR to GEMDIR before using code!
Select All
I have made notes in code below and it will effect functionality!
Use the Select All choice above!

<SCRIPT LANGUAGE="Javascript"><!--
// ***********************************************
// AUTHOR: WWW.CGISCRIPT.NET, LLC
// URL: http://www.cgiscript.net
// Use the script, just leave this message intact.
// Download your FREE CGI/Perl Scripts today!
// ( http://www.cgiscript.net/scripts.htm )
// ***********************************************

function image() {
};

image = new image();
number = 0;

// imageArray
image[number++] = "<img src='^GEMDIR/wmslide1.jpg' border='0'>"
image[number++] = "<img src='^GEMDIR/wmslide2.jpg' border='0'>"
image[number++] = "<img src='^GEMDIR/wmslide3.jpg' border='0'>"
image[number++] = "<img src='^GEMDIR/wmslide4.jpg' border='0'>"
image[number++] = "<img src='^GEMDIR/wmfslide1.jpg' border='0'>"
// keep adding items here...

increment = Math.floor(Math.random() * number);

document.write(image[increment]);

//--></SCRIPT>

 
SAMPLE 2:
Reload the page
to see the image change

Each image links to a different page
in this same window


Want to open the link in a new window?  or remove the dotted line when you click the link?
Modified script to work in CSB and Trellix shown below.
This script is from Javascript Kit.  Visit for the original script and many more!!

Place this script into an Insert > HTML (webgem in Trellix). Include the images in the webcomponent.
Change RED item to your image name.
Change BLUE item to your link.
To capture the code, press Select All then COPY the contents.
MUST change each gEMDIR to GEMDIR before using code!
Select All
I have made notes in code below and it will effect functionality!
Use the Select All choice above!
<script language="JavaScript">
<!--

/*
Random Image Link Script- By JavaScript Kit(http://www.javascriptkit.com)
Over 200+ free JavaScripts here!
Updated: 00/04/25
*/

function random_imglink(){
var myimages=new Array()
//specify random images below. You can have as many as you wish
myimages[1]="^GEMDIR/wmslide1.jpg"
myimages[2]="^GEMDIR/wmslide1.jpg"
myimages[3]="^GEMDIR/wmslide1.jpg"
myimages[4]="^GEMDIR/wmslide1.jpg"
myimages[5]="^GEMDIR/wmfslide1.jpg"
myimages[6]="^GEMDIR/wmfslide2.jpg"

//specify corresponding links below
var imagelinks=new Array()
imagelinks[1]="http://www.javascriptkit.com"
imagelinks[2]="http://www.netscape.com"
imagelinks[3]="http://www.microsoft.com"
imagelinks[4]="http://www.dynamicdrive.com"
imagelinks[5]="http://www.freewarejava.com"
imagelinks[6]="http://www.cnn.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>