#1
  1. I'm baack!!
    ASP Discoverer (100 - 499 posts)

    Join Date
    Apr 2004
    Location
    In a suburb of Atlanta, GA, in front of my MacBook.
    Posts
    181
    Rep Power
    34

    Drop Down List and CSS


    Is it possible to have each item in a <select><option> tag set to have a different background color?

    Thanks for any help,
    Chris
    ~`^%
  2. #2
  3. Frustrated Wizard
    ASP Hero (2000 - 2499 posts)

    Join Date
    Apr 2005
    Posts
    2,419
    Rep Power
    24
    yes it is, i show you how
    EXAMPLE:
    Code:
    <head>
    <style>
    option.option_select_ok {
     color:green
     }
    option.option_select_nok {
     color:red
     }
    </style>
    </head>
     
    <body>
    <select name="select_box">
    <option <%If RS("defined") = true Then%>class="option_select_ok"<%ElseIf RS("defined") = false Then%>class="option_select_nok"<%End If%> value="">optiontext</option>
    </select>
    </body>
  4. #3
  5. Frustrated Wizard
    ASP Hero (2000 - 2499 posts)

    Join Date
    Apr 2005
    Posts
    2,419
    Rep Power
    24
    this example is coloring the text of the option, but you can do the same with background color by using:
    Code:
    background-color: ...............
    when you wanne make it dynamic, you have to randomize the colors with ASP's randomize / rnd() function
    Last edited by leuvenaar; September 22nd, 2005 at 01:44 PM.

IMN logo majestic logo threadwatch logo seochat tools logo