HighDots Forums  

Swapping images on load

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Swapping images on load in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
MG41
 
Posts: n/a

Default Swapping images on load - 11-02-2005 , 06:19 PM






:music;
Using Dreamweaver 2004 MX, I want to insert images on my home page, keep a
library, and then have another image of the same size load in that spot the
next time. I also have Fireworks 2004, but I'm not very familiar with it.

If anyone can help me with this process, I would very appreciative.
http://www.rochester.edu is a good example of what I'm after.

Any help is appreciated, as always,

MG


Reply With Quote
  #2  
Old   
Murray *TMM*
 
Posts: n/a

Default Re: Swapping images on load - 11-02-2005 , 06:48 PM






Here's a way to do a random image load -

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 -->



--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver
(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
==================


"MG41" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
:music;
Using Dreamweaver 2004 MX, I want to insert images on my home page, keep a
library, and then have another image of the same size load in that spot
the
next time. I also have Fireworks 2004, but I'm not very familiar with it.

If anyone can help me with this process, I would very appreciative.
http://www.rochester.edu is a good example of what I'm after.

Any help is appreciated, as always,

MG




Reply With Quote
  #3  
Old   
WebspinnerInc
 
Posts: n/a

Default Re: Swapping images on load - 11-02-2005 , 07:07 PM



using Cold Fusion, ASP or PHP you can set the src attribute of an image element
to be any dynamic value. Then you can use any method you like to change that
value.

an example would be to have a directory with all your images, lets say
img/front/
and in here you place your images naming them 1.jpg, 2.jpg, 3.jpg, 4.jpg etc.

Then you load the index page (in this example an asp file) with an image that
uses a dynamic value.

<img src="img/front/<%= imgCount %>.jpg" />

Then at the top of this page lets say you grab the last digit of the current
second.

Dim imgCount
imgCount = Second.Now
imgCount = Right(imgCount, 1)

This will give you a random image name 0.jpg through 9.jpg

Obviously you can get more or less complicated with this as you like.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.