Skip to main content
Inspiring
April 27, 2006
Question

different coloured drop down list....

  • April 27, 2006
  • 1 reply
  • 250 views
hi there all,

I have a drop down list which is dynamic, it brings up a long list of staff.
Is there a way that I can make the background on the list, a different colour depending on the job of staff.

So for example on the list, it would all be white BG, but if there is say a manager the bg behind that name would be blue..?

is that possible or am I being way toooo optimistic...?

many thanks
This topic has been closed for replies.

1 reply

Inspiring
April 27, 2006
On 27 Apr 2006 in macromedia.dreamweaver.appdev, Simonbullen wrote:

> I have a drop down list which is dynamic, it brings up a long list
> of staff. Is there a way that I can make the background on the list,
> a different colour depending on the job of staff.
>
> So for example on the list, it would all be white BG, but if there
> is say a manager the bg behind that name would be blue..?

<option>s will take a background color, thus:

<select name="menu2">
<option value="0" style="background-color:#ccf;">Home</option>
<option value="1" style="background-color:#cfc;">Products List</option>
<option value="2" style="background-color:#fcc;">Tutorials list</option>
<option value="3">Extensions list</option>
<option value="4">Support</option>
</select>

What you're doing is, I assume, something like this (pseudocode):

<select name="menu2">
<& start repeat &>
<option value="<& print value &>"><& print name &></option>
<& end repeat &>
</select>

What you would do:

<select name="menu2">
<& start repeat &>
<option value="<& print value &>" style="<& print stylename &>"><& print name &></option>
<& end repeat &>
</select>

This would involve adding a stylename to every record, or if you
already have something you could use as a stylename, like a job
description, adding that to the <option> as a class.

Optionally, you could do something like:

<option value="<& print value &>" <& if class='manager' print 'style="manager"' &>><& print name &></option>

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/email.php