Link to home
Start Free TrialLog in
Avatar of MeenakshiDhar
MeenakshiDhar

asked on

stylesheet for combo box

Hi All,
I have one combobox in my form.
The contents are displayed in the following manner in the combobox :

Test1   (AAAAA)   -- 11111
Test2   (BBBBBB)   -- 22222
Test3   (CCCCCC)   -- 333333
Test4   (DDDDDD)   -- 444444
Test5   (EEEEEE)   -- 555555

..... so on

I want to display Test1, Test2, Test3... in different colors...Similarly "AAAAAA", "BBBBBB", "CCCCCC"...in different color...and "11111", "222222" ...in different color...

Thanks in advance...
Meenakshi Dhar
ASKER CERTIFIED SOLUTION
Avatar of sam85281
sam85281

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MeenakshiDhar
MeenakshiDhar

ASKER

Ok is it not possible at all?? I mean any other way to do it.....
sam is right, you can only change the color of options tags.
No way to put two different colors in a single option tag.
If you really want to do so, you will have to make your own custom combo-like control with JavaScript/CSS.
if you fill your data from database and your page is for instance asp  you could do like this , and define array of colors and set it for each data which you read from database instead of fixed color which I used in below (  "color:black"   )
"color:" & arr(1)

<select size="19" class="MT" name="D1"  style="border: 0px solid #285007; padding: 0; background-color: #EEEEEE; scrollbar-highlight-color:#00ff00; scrollbar-base-color:green ; font-weight:bold" >

<%
          while NOT RS.EOF%><option
          style=<%
         "color:black"  
          value="<%
          Response.write "yourvalue"))
             %>">
   </option><%
           RS.MoveNext
          WEND
          %>
 </select>
then it means you could only have one color for each option as others told u
yes.. sara110 is right...