| Welcome to WebmasterWorld Guest from 184.108.40.206 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Become a Pro Member|
I have a web page that has a small table to the left of the main content. The background of that area is an image that is defined in the css file.
Is it possible to place a script in there for the image to randomly rotate to a new one with still using the css?
You can use php, style.php :
$rand_num = mt_rand(1, 4);
background-image: url('randimage<?php echo $rand_num ?>.gif');
The first line is the most important because it will send the right header to the browser. The variable $rand_num is assigned a number between 1 to 4.
You'll have four images:
randimage2.gif ... etc
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved