SunQuest
           CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 27th, 2003, 06:29 AM
fr0styxm fr0styxm is offline
Still learning...
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Cheshire, UK
Posts: 58 fr0styxm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
CSS Styles for <Select> list

Hello

I need to know, if its possible using CSS or JS to..

Have alternating colours in a select list. Not a drop down menu, a select list which will have multiple selections.

One thing I should mention, the contents of the list are PHP dynamic... Im sorry if this isn't a post for this forum.

Thank you in advance....
__________________
... shamone! ...

-

Welcome to DevShed!

How to post questions | MySQL Website | PHP Website | Always lewk before posting

Reply With Quote
  #2  
Old August 27th, 2003, 07:15 AM
magma's Avatar
magma magma is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Italy, EU
Posts: 517 magma User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 45 m 8 sec
Reputation Power: 6
I think that if you're using PHP you can set the colors while generating the code...
Post your code or send it!!
__________________
Cheers, Dave

Reply With Quote
  #3  
Old August 27th, 2003, 07:17 AM
ibidris2003 ibidris2003 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 249 ibidris2003 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Yes, you can define a css class for the option tag:
option.classname
{ color:
background-color ;
}

then generate option tags like this
<option class="<? echo classname; ?>">

http://galileo.spaceports.com/~ibidris/

Reply With Quote
  #4  
Old August 27th, 2003, 07:29 AM
fr0styxm fr0styxm is offline
Still learning...
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Cheshire, UK
Posts: 58 fr0styxm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Quote:
Originally posted by magma
I think that if you're using PHP you can set the colors while generating the code...
Post your code or send it!!

Ahh yes, my code is

PHP Code:
<select name="Industry_Org_Type[]" size="4" multiple id="select">
<
option value="Industry / Org" selected>-- Organisation Type --</option>
<?
php do {  ?>
<option value="<?php echo $row_rsDropDown2['Org Code']?>"><?php echo $row_rsDropDown2['Organisation Type']?></option>
<?php
} while ($row_rsDropDown2 mysql_fetch_assoc($rsDropDown2));
  
$rows mysql_num_rows($rsDropDown2);
  if(
$rows 0) {
      
mysql_data_seek($rsDropDown20);
      
$row_rsDropDown2 mysql_fetch_assoc($rsDropDown2);
  }
?></select> 

Reply With Quote
  #5  
Old August 27th, 2003, 07:37 AM
fr0styxm fr0styxm is offline
Still learning...
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Cheshire, UK
Posts: 58 fr0styxm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Quote:
Originally posted by ibidris2003
Yes, you can define a css class for the option tag:
option.classname
{ color:
background-color ;
}

then generate option tags like this
<option class="<? echo classname; ?>">

http://galileo.spaceports.com/~ibidris/


What about alternating the rows? Ie, one row white, the next blue, and so on and so forth

Reply With Quote
  #6  
Old August 27th, 2003, 07:57 AM
magma's Avatar
magma magma is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Italy, EU
Posts: 517 magma User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 45 m 8 sec
Reputation Power: 6
You can define two classes like:
Code:
.bg1 {
    background-color: green;
}
.bg2 {
    background-color: lime;
}

...and then...


PHP Code:
<?php
$boo 
0;
do {
if(
$boo$aClass "class='bg1'";
else  
$aClass "class='bg2'";
$boo=!$boo;
?>
<option <?php echo $aClass?> value="<?php echo $row_rsDropDown2['Org Code']?>"><?php echo $row_rsDropDown2['Organisation Type']?></option>
I don't know if this is the easiest way, but should work!!

Last edited by magma : August 27th, 2003 at 08:12 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > CSS Styles for <Select> list


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway