View Full Version : Random Content Order script

Orlando Dude
09-13-2006, 04:48 PM
1) Script Title: Random Content Order script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/randomcontentorder.htm

3) Describe problem: Trying to randomise banner advert graphics with different coloured backgrounds using different styles. Different style color for a category.

Script works fine but if I have -
<script type="text/javascript">

//randomize order of contents with DIV class="group1"


group 1 and group 2 randomise separately.

Can I get them all to randomise together.

Tried -
<div class="group1 group2">

This works but randomises the content not the whole <div> .Advert graphics goin the wrong color <div>.


09-13-2006, 06:49 PM
Hmm I'm not sure I understand. Whether group 1 and group 2 randomise separately or "together", the end result is that the two groups are randomized. If you're talking about giving both group 1 and group 2 a common style, you can do that by giving both groups an extra, shared class, like:

<div class="group1 sharedstyle">

<div class="group2 sharedstyle">

09-13-2006, 07:02 PM
The way to get all of the items to randomize together would be to give them all the same group class - say, group1. If you need to have different classes for the background colors within group1, the divisions in group1 can have additional classes for their background colors:

<style type="text/css">
.group1 {
visibility: hidden;
.c1 {
.c2 {

<div class="group1 c1">

for items in group1 that also have color styling defined by the class selector "c1" and:

<div class="group1 c2">

for items in group1 that also have color styling defined by the class selector "c2".

Orlando Dude
09-14-2006, 03:33 PM

Kinda makes sense (I think).

I'll give it a go and report back.

Thanks again.

Orlando Dude
09-15-2006, 02:48 PM
I put the sytles in an external .css - would that make a diference?

Test page -

Tickets Companies are supposed to be in red boxes and red boxes shoulkd shuffle with grey boxes (if possible)


Orlando Dude
09-15-2006, 03:23 PM
OK think I get it now...

To do what I want would require applying the Style to the Image.

This is not possible I believe???


Orlando Dude
09-15-2006, 03:29 PM
Thought I had it for a moment...

Figured how to put a Style to an Image but now an image can't have a background - brat.

Is there any way to nest <div>'s?

Orlando Dude
09-15-2006, 03:58 PM
Got it...

Nested a <div> in the <div>.


Just wonder if it can be simplified?