This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes colored text in dropdown Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "colored text in dropdown " Watch "colored text in dropdown " New topic

colored text in dropdown

satish pune
Ranch Hand

Joined: Sep 04, 2003
Posts: 44
Hello ,
I am using struts and in a form I have a dropdown / select box
I want a selective part of the text in the dropdown to appear in Red color
Here is how the code looks like :
<logic:iterate id="someName" name="<%=USER_DETAILS%>" type="UserAccountDetails">
<html ption value="customerId">
<bean:write name="someName" property="Name" />--
<bean:write name="someName" property="SurName" />--
<bean:write name="someName" property="balance" />
</html ption>
The one in bold is what i want in red .
Thanks in advance ,
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
How about setting the propertly "balance" in the bean itself along with the html tags like
String balance = "<font color='red'>"+ $(balance value here)+"</font>";

- Varun
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
THis is how you would code it on the html side, you do not use font tags in a dropdown!

I agree. Here's the link:
subject: colored text in dropdown
It's not a secret anymore!