Results 1 to 8 of 8

Thread: Random Content Order script

  1. #1
    Join Date
    Sep 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Random Content Order script

    1) Script Title: Random Content Order script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...ntentorder.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"
    randomizeContent("group1")
    randomizeContent("group2")

    </script>

    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>.

    Thanks

  2. #2
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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:

    Code:
    <div class="group1 sharedstyle">
    </div>
    
    <div class="group2 sharedstyle">
    </div>

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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:

    Code:
    <style type="text/css">
    .group1 {
    visibility: hidden;
    }
    .c1 {
    background-color:red;
    }
    .c2 {
    background-color:green;
    }
    </style>
    HTML Code:
    <div class="group1 c1">
    for items in group1 that also have color styling defined by the class selector "c1" and:

    HTML Code:
    <div class="group1 c2">
    for items in group1 that also have color styling defined by the class selector "c2".
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Sep 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thanks

    Thanks.

    Kinda makes sense (I think).

    I'll give it a go and report back.

    Thanks again.

  5. #5
    Join Date
    Sep 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I put the sytles in an external .css - would that make a diference?

    Test page -
    http://orlando-maps.info/_advertiser...dvertisers.htm

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

    thanks

  6. #6
    Join Date
    Sep 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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???

    Ta

  7. #7
    Join Date
    Sep 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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?

  8. #8
    Join Date
    Sep 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Got it...

    Nested a <div> in the <div>.

    http://www.orlando-maps.info/_advert...dvertisers.htm

    Just wonder if it can be simplified?

    Thanks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •