This is a discussion on "Random div background" within the JavaScript Forum section. This forum, and the thread "Random div background are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Random div background
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Random div background
Hey all,
I have created a site using div's rather than tables and I want one of the divs to randomly change background as the user visits and refreshes the page. I found a site which offers something very close... http://www.groan-zone.net/jscript/random.html This works perfect but it changes the main background of the page. I can see the bit of the code which tells it to change the body background specifically and assume that this is the part I need to change but I don't know what to change it to to refer it to a div (the div id in question is header, if that helps explaining it). Does anyone have any ideas? It would be greatly appreciated. Thanks |
|
|
|
||||
|
Re: Random div background
without looking you might need to create a 'class' and use that
Last Blog Entry: Basic Advice for newbies (Feb 1st, 2008)
|
|
|||
|
Re: Random div background
I am no expert, but something like this might work '(or not)'
|
|
|||
|
Re: Random div background
dab24pat,
Thanks but I've tried a lot of trial-and-error approachs including what you laid out. saltedm8, Thanks as well, I thought I might have to make a class for it I just have to figure that part out lol Here's the CSS code for the header if it's any help: #header { padding:0.5em; color:white; margin-top:10px; margin-left:10px; margin-right:10px; } |
|
||||
|
Re: Random div background
to create a 'class' you need to do something like this
Last Blog Entry: Basic Advice for newbies (Feb 1st, 2008)
Last edited by saltedm8; Mar 6th, 2008 at 17:46. |
|
|||
|
Re: Random div background
This will do what you're looking for: http://www.alistapart.com/articles/betterrotator
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Looking for random bouncing ball | bubberz | Flash & Multimedia Forum | 1 | Oct 24th, 2007 21:35 |
| Random .swf on refresh | jtyoungs | JavaScript Forum | 2 | Sep 19th, 2007 12:48 |
| Issues with random background music | elusified | JavaScript Forum | 0 | Aug 28th, 2007 10:10 |
| random | benbramz | Classic ASP | 5 | Jul 18th, 2005 05:01 |
| Random records.. | u2orange | Databases | 6 | Mar 8th, 2004 09:31 |