Change option look.


A question:
How to use something like this using not the font color but the font-family??

<SELECT NAME="FontColor">
<OPTION VALUE="Aqua" style="color: Aqua;">Aqua</OPTION>
<OPTION VALUE="Black" style="color: Black;">Black</OPTION>
<OPTION VALUE="Blue" style="color: Blue;">Blue</OPTION>

Here the option value changes to the color set in the style value!

I want to use something like:
<OPTION VALUE="Arial" style="family: Arial;">Arial</OPTION>

I tried this but I would not work??

Can someone help me??

greetings Michel
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


If it is possible (and I am not sure it is), what you would need is:

<option value="Blue"><font color="Blue">Blue</font></option>
<option value="Arial"><font face="Arial">Arial</font></option>

Give that a try.

If your style coding above worked, you might also try:

<option value="Arial" style="font-family:Arial"> or "font-face:Arial"  (sorry, I don't remember which syntax is right)

As I said, I am not sure you can do this in any case as part of a select statement.

mmcwAuthor Commented:
Your first answer is not what I need. In my question I already say that that works fine. Your second answer does not work!!
But that is also what I say in my question
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

try using this:

<select size="1" name="D1" style="font-family: Arial">

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BTW, change the name "D1" to your options box name "FontColor"...
mmcwAuthor Commented:
That is not what I want!
I want something like this:

<OPTION VALUE="Arial" style="family: Arial;">Arial</OPTION>
<OPTION VALUE="Courier" style="family: Courier;">Courier</OPTION>
<OPTION VALUE="Comic Sans SM" style="family: Comic Sans SM;">Comic Sans SM</OPTION>

The font style of each option has to change and not for ALL!

As I said in my initial comment, I think the answer to your question is, "You cannot do this".

I assumed from your initial question that the code you specified for changing colors worked (and I indicated this).  I tried it, and it does.  My initial suggestion regarding the color was in case your code was NOT working.

What I initially suggested with regard to the font was that the syntax you were using for the font family was not correct.  The correct syntax is "font-family".  However, that does not seem to work in this instance.


Yep.  Sorry but TTom is correct if that is what you want.  This is an all or none deal...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.