PDA

View Full Version : Random Background Change


Jayboyband
06-19-2006, 07:40 AM
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...

http://www.development-partners.co.uk/

Cheers

Creative Insanity
06-19-2006, 10:02 AM
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.

rediffusion
01-17-2009, 06:49 PM
Hi,

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:
http://www.randam.org/NickWilson/test.html

but want a random image to appear each time:
http://www.randam.org/NickWilson/images/WebOpeners/image01.jpg
http://www.randam.org/NickWilson/images/WebOpeners/image02.jpg
http://www.randam.org/NickWilson/images/WebOpeners/image03.jpg

Can anybody help?

thanks
R ;)

domedia
01-18-2009, 06:02 PM
This thread is over 2 years old.
Please start your own thread.
Welcome to the forums btw! :)

edbr
01-19-2009, 12:01 AM
heres a php answer to this , havent used it but should work

<?php

/*
* 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\" />";

?>