473,401 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

how to change color of option tag in select

can i use like this
Expand|Select|Wrap|Line Numbers
  1. <select name="test" >
  2. <option value="1">option</option>
  3. <option value="2"><p style="background-color:#FF0055;">again</p></option>
  4. </select>
  5.  
i don't want to use style in the option tag.
because i am getting the option text from database.
so i want to apply style to the text only.

because i have no chance to use styles in the option tag. that is strictly avoided by my existing code.i am allowed to do changes to the text part only.
i am not allowed to touch option tag or select tag.

i tried like this also

Expand|Select|Wrap|Line Numbers
  1. <option value="2"><font color=red>again</font></option>
  2.  
any help pls...
Feb 27 '09 #1
1 7922
Dormilich
8,658 Expert Mod 8TB
it would be helpful if you could add an id attribute to every option tag. this would make applying CSS a piece of cake.

if that's not possible, I can only think of Javascript to solve that.

besides that, <option> must only contain text (aka #PCDATA).
Feb 27 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: pearl | last post by:
We have a primary OWA (5.5) server and a secondary OWA server. The primary OWA server's change password option truncates first letter of the username when prompted. The secondary OWA server does...
2
by: chichi | last post by:
Hi there! I was wondering if somebody could tell me how to edit the following ASP code so that the text within the tables appears as Font Color "00FF00". Right now it is appearing in BLACK and...
3
by: Diane Yocom | last post by:
Has anybody ever seen or written code for ASP that would mimic Access' multi-column combo box? Specifically, I have a drop down box that lists about 100 five-digit codes. Each of these codes has...
1
by: James | last post by:
I'm trying to make a select box where each of 3 elements shows up as a different color. I've gotten it working on the PC, but seem to be having some troubles with the Mac/IE combo. Apparently...
1
by: Bill S. | last post by:
Is there a way to set the font-weight for the <option> items in a select list in a form, ie: <td> <select name="txtMenuStatus" size="1"> <option id="optActive">active</option> <option...
5
by: tomcarr1 | last post by:
I have an ASP.net webform with a datagrid on it. I can change the SQL select statement for the grid in code by putting a statement like this in the first line of Page_Load...
1
by: Benaron | last post by:
I'm a javascript newbie - so although I can follow scripts and write simple ones, I get stuck when things don't work. I'm trying to have a help section on my web-site where each question/FAQ will...
0
by: nicolass | last post by:
Hi, Im new in c# :) I wonder how to change color of some cell if there is some criteria. ie. if value in cell = John then color of that cell is Red This very easy in PHP but c#.. :(
1
irfanmodan
by: irfanmodan | last post by:
Hi Everybody, i have one critical problem in HTML, when i using select tag, for eg: <select> <option>Test 1</option>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.