Re: [WSG] baground image random

2006-05-30 Thread Rik Lomas
This line:var rand = Math.floor(Math.random % bgs.length);should be:var rand = Math.floor(Math.random() * bgs.length);On 26/05/06, 1802
 <[EMAIL PROTECTED]> wrote:>This one runs off PHP, but I'm not sure how this would work with CSS.
>I'm sure it could be adapted:>http://www.alistapart.com/articles/randomizerAnd>I've been playing around with random background images for a while now,
>and have just posted a quickly put together script detailing one method>to achieve this at>ation/>.Tnx, but I prefer to use a client side option for now.Warren, your script appears simple, but it doesn't works.I'm triyng this on one of my (beta) site
http://www.adtweb.it/beta/home.aspThe element I want to make background is div#head, this is mycostumization. But  nothing appears...>
>
>var elementID = "head"; // ID of element to change the background
>of, or "BODY" for body
>var bgs = new Array(); // Possible backgrounds
>bgs[0] = "css/img/background1.jpg";
>bgs[1] = "css/img/background2.jpg";
>bgs[2] = "css/img/background3.jpg";
>bgs[3] = "css/img/background4.jpg";
>
>var rand = Math.floor(Math.random % bgs.length);
>
>(elementID == "head" ? document.body :
>document.getElementById(elementID)).style.backgroundImage = "url(" +
>bgs[rand] + ")";
>--Matteo Discardi 1802http://homepage.mac.com/matteo.discardi"Transcending History and the World, a tale of Soul and Swordseternally retold"SoulCalibur**The discussion list for  http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help** -- Rik Lomashttp://rikrikrik.com

Re: [WSG] baground image random

2006-05-26 Thread 1802

This one runs off PHP, but I'm not sure how this would work with CSS.
I'm sure it could be adapted:
http://www.alistapart.com/articles/randomizer


And


I've been playing around with random background images for a while now,
and have just posted a quickly put together script detailing one method
to achieve this at
.


Tnx, but I prefer to use a client side option for now.

Warren, your script appears simple, but it doesn't works.
I'm triyng this on one of my (beta) site

http://www.adtweb.it/beta/home.asp

The element I want to make background is div#head, this is my 
costumization. But  nothing appears...





var elementID = "head"; // ID of element to change the background of, or "BODY" for body
var bgs = new Array(); // Possible backgrounds
bgs[0] = "css/img/background1.jpg";
bgs[1] = "css/img/background2.jpg";
bgs[2] = "css/img/background3.jpg";
bgs[3] = "css/img/background4.jpg";

var rand = Math.floor(Math.random % bgs.length);

(elementID == "head" ? document.body : document.getElementById(elementID)).style.backgroundImage = "url(" + bgs[rand] + ")";




--

Matteo Discardi 1802
http://homepage.mac.com/matteo.discardi

"Transcending History and the World,
a tale of Soul and Swords
eternally retold"
SoulCalibur
**
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
**



RE: [WSG] baground image random

2006-05-25 Thread Scott Swabey
1802 wrote:
> Do you know a js fro put a background image at random in css?

I've been playing around with random background images for a while now,
and have just posted a quickly put together script detailing one method
to achieve this at
. 

This method uses PHP to retrieve a random image from a folder and write
a dynamic CSS declaration through the page headers.

Regards

Scott Swabey
Design & Development Director

Lafinboy Productions
www.lafinboy.com

www.thought-after.com




**
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
**



RE: [WSG] baground image random

2006-05-25 Thread Graham, Timothy
This one runs off PHP, but I'm not sure how this would work with CSS.
I'm sure it could be adapted:
http://www.alistapart.com/articles/randomizer.

If you tried replacing



With something like

body {background:url(/path/to/images/rotate.php) center no-repeat;}


TIM GRAHAM

-Original Message-
From: listdad@webstandardsgroup.org
[mailto:[EMAIL PROTECTED] On Behalf Of 1802
Sent: Friday, May 26, 2006 1:20 AM
To: wsg@webstandardsgroup.org
Subject: [WSG] baground image random

Hi everyone.
Do you know a js fro put a background image at random in css?

cross browser, of course :)

Tnx
-- 

Matteo Discardi 1802
http://homepage.mac.com/matteo.discardi

"Transcending History and the World,
a tale of Soul and Swords
eternally retold"
SoulCalibur
**
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
**



DISCLAIMER:This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they are 
addressed. If you have received this email in error please notify the system 
manager. Please note that any views or opinions presented in this email are 
solely those of the author and do not necessarily represent those of the 
School. Finally, the recipient should check this email and any attachments for 
the presence of viruses. The School accepts no liability for any damage caused 
by any virus transmitted by this email
**
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
**



Re: [WSG] baground image random

2006-05-25 Thread Warren Cardinal
oops - it was cutoff
 


var elementID = "divone"; // ID of element to change the background of, or "BODY" for body
var bgs = new Array(); // Possible backgrounds
bgs[0] = "background1.jpg";
bgs[1] = "background2.png";
bgs[2] = "background3.gif";

var rand = Math.floor(Math.random % bgs.length);

(elementID == "BODY" ? document.body : document.getElementById(elementID)).style.backgroundImage = "url(" + bgs[rand] + ")";
    On 5/25/06, Warren Cardinal <[EMAIL PROTECTED]> wrote: try this...  

Re: [WSG] baground image random

2006-05-25 Thread Warren Cardinal
try this...
 

[WSG] baground image random

2006-05-25 Thread 1802

Hi everyone.
Do you know a js fro put a background image at random in css?

cross browser, of course :)

Tnx
--

Matteo Discardi 1802
http://homepage.mac.com/matteo.discardi

"Transcending History and the World,
a tale of Soul and Swords
eternally retold"
SoulCalibur
**
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
**