Random images on a FP2003 site

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a folder of images that are more or less the same size (or I can make
them the same size). In a layout cell, I want to show one of these images at
a time, at random, upon each load. Can't find a way to do this yet.
Jerry
 
You would need to search for the following in your IE address bar:

? JavaScript Random Image Display Script

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
Create an array in JavaScript (can be loaded from a file)
Randomly select an item from that array
Load the picture corresponding to the item

That is the HTML way. If you go to an ASP solution, you can actually bind
the image tag to the image before the HTML is sent out from the server.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***********************************************
Think Outside the Box!
***********************************************
 
Put this in the head of the document -

<script type="text/javascript">
<!--
function displayRandomImage(imageName,array){
document.images[imageName].src=array[new Date().getTime()%array.length];
}
urls=["images/cs1.jpg","images/cs2.jpg","images/cs3.jpg","images/cs4.jpg"]
// load this line with your image names and paths
//-->
</script>

and then put this in the body of the page -

<body onLoad="displayRandomImage('csmember',urls)">
<!-- csmember is the NAME of the image receiving the random changes -->
 
Thanks for all your responses.
I know nothing about javascript.
I will have to do some studying and playing with code to see if I can
properly implement this.
Thanks
Jerry
 
Back
Top