Go Back   Dreamweaver Club Forums > Dreamweaver forums > Dreamweaver General
Register FAQ Members List Search Today's Posts Mark Forums Read

Thread Tools Display Modes
Old 06-19-2006, 07:40 AM   #1
Join Date: Jun 2006
Location: Windsor, UK
Posts: 2
Default Random Background Change

Been asked by a client to change the background and hyperlink colours randomly on each page everytime a page is refreshed...

Is there some code out there somewhere that already has this sussed?

Hope this makes sense... I've found this site that does exactly what I want to do...


Jayboyband is offline   Reply With Quote
Old 06-19-2006, 10:02 AM   #2
Creative Insanity
Creative Insanity's Avatar
Join Date: Oct 2005
Location: KiwiLand (stalk that far dj LOL)
Posts: 1,967

Simple.. if you study that site you will see it is just a simple matter of using a differant style sheet for each link like that site does.
Creative Insanity is offline   Reply With Quote
Old 01-17-2009, 06:49 PM   #3
Join Date: Jan 2009
Posts: 1


I'm new here. I am also trying to work out how to make my background images random. I just need to create a page which features these images spanning 100%.

I have already created this:

but want a random image to appear each time:

Can anybody help?

rediffusion is offline   Reply With Quote
Old 01-18-2009, 06:02 PM   #4
domedia's Avatar
Join Date: Dec 2003
Posts: 9,730

This thread is over 2 years old.
Please start your own thread.
Welcome to the forums btw!
domedia is offline   Reply With Quote
Old 01-19-2009, 12:01 AM   #5
edbr's Avatar
Join Date: Aug 2005
Location: Bali
Posts: 11,203

heres a php answer to this , havent used it but should work


* Name your images 1.jpg, 2.jpg etc.
* Add this line to your page where you want the images to
* appear: <?php include "randomimage.php"; ?>

// Change this to the total number of images in the folder
$total = "11";

// Change to the type of files to use eg. .jpg or .gif
$file_type = ".jpg";

// Change to the location of the folder containing the images
$image_folder = "images/random";

// You do not need to edit below this line

$start = "1";

$random = mt_rand($start, $total);

$image_name = $random . $file_type;

echo "<img src=\"$image_folder/$image_name\" alt=\"$image_name\" />";

If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote

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

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

Forum Jump

All times are GMT. The time now is 12:54 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com