Skip to main content
Participant
August 8, 2006
Question

is random imaging a behavior?

  • August 8, 2006
  • 2 replies
  • 274 views
is random imaging a behavior already available or one i need to find/load or neither? i want a different image to appear (1 of 6) each time any user goes to the page - but not sure how to do this.
This topic has been closed for replies.

2 replies

DEMeloneAuthor
Participant
August 10, 2006
thanks for the help - you're awesome! demh
Inspiring
August 8, 2006
It's not a DW behavior, but it's simple enough to do.

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 HTML NAME (not the filename) of the image receiving the
random changes -->

You can see this in action here -
http://www.dreamweaverresources.com/tutorials/randomimage_perpage.html

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"dmeloneh" <webforumsuser@macromedia.com> wrote in message
news:ebaup0$8ok$1@forums.macromedia.com...
> is random imaging a behavior already available or one i need to find/load
> or neither? i want a different image to appear (1 of 6) each time any
> user goes to the page - but not sure how to do this.