PDA

View Full Version : Random banners help


cerpnjak
07-18-2007, 05:50 PM
hi there, I'm fairly new to Dreamweaver just learning as I go but I'm stuck now. I've been asked to put advertising banners on a site which, when you reload or refresh the page, they randomly change.
I've seen bits of script that will do this but my scripting skills aren't the best and I could do with a more broken down step by step guide.
can anyone help at all?
Cheers
Pete

domedia
07-18-2007, 06:13 PM
Are you going to manage these banners in a db?
If so you might use PHP to randomly display a banner, If not might as well just use JS to select from a list of images.

cocoonfx
07-18-2007, 11:15 PM
cerpnjak you could use flash. This is what i would use.

cerpnjak
07-19-2007, 09:21 AM
I probably could use Flash but not brilliant with it. Basically on the site are a number of sponsors all who can have these advertising banners, what I want to do is to be able to put the banners in a folder and then use some sort of script to tell DW to go in a pick randomly from whatevers in the folder.
Can this be done? I'm sure I've seen script that can do it, only thing is I'm not entirely sure how to implement it. So if anyone knows of any script I would be most appreciative if they could post it up and also give me a brief rundown of how to use it]
Many thanks
Pete

davidj
07-19-2007, 10:02 AM
yes it can be done using Javascript

i think i have written one or two in my time

i will dig one out for you

cocoonfx
07-19-2007, 11:32 AM
I will also dig out the flash code as well as i have done this before on promotional cd-roms.

So you have the best of both worlds.

cerpnjak
07-19-2007, 11:36 AM
Thanks guys it's much appreciated

cocoonfx
07-19-2007, 10:38 PM
You then need to add a layer at the top a flash movie which is going to be the place holder and you use the following code:-

pic = random(3)+1;
loadMovie("pic"+pic+".jpg", _root.here);

You need to place the images in the same folder locations and then name them say "pic"

From example

pic1.jpg
pic2.jpg
pic3.jpg


Hope this helps.....

chriskq
07-20-2007, 02:36 AM
heres a tutorial if your still stuck

http://www.kirupa.com/developer/mx/loadingrandombackground.htm