Solved

How do I bold a <option> tag, or change the color??

Posted on 2004-09-01
5
297 Views
Last Modified: 2010-08-05
Hi there I want the else statement option tag to be bolded and/or have a different forecolor or bgcolor, how do I do that?

if RS.Fields("TeacherType") = 1 then
         Response.Write "<option value=" & chr(34) & CStr(RS.Fields(0).Value) & chr(34) & ">" & RS.Fields("LastName").Value & ", " & RS.Fields("FirstName").Value & " - " & RS.Fields("City").Value  & "</option>" & vbLf
        else
        Response.Write "<option value=" & chr(34) & CStr(RS.Fields(0).Value) & chr(34) & ">" & "STA " & RS.Fields("LastName").Value & ", " & RS.Fields("FirstName").Value & " - " & RS.Fields("City").Value & "</option>" & vbLf
         End if
0
Comment
Question by:Gezna
  • 3
5 Comments
 
LVL 11

Accepted Solution

by:
SweatCoder earned 500 total points
ID: 11954642
try style="bgcolor:red;" or style="color:red;"

insert 1 of the above into the <option> section
0
 
LVL 11

Expert Comment

by:SweatCoder
ID: 11954651
but if you're response.writing it, watch out for the quotes. maybe use single quotes instead.
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 11954943
Hi SweatCoder,
 font-weight: bold;

Regards,
---Pinal
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 11955181
Hi Gezna,

You need to be specific with how you style the select. For instance, you can't bold individual options, only the whole select tag. Font and backgrounds, can however, be individually styled.

See below for an example of each rendition:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>

<style type="text/css">

.special
{
      font-weight:bold;
}

.green
{
      color:green;
}

.grey
{
      background-color:#cccccc;
}

</style>
</head>

<body>
<form id="myform">
<select class="special">
<option class="green" value="text">Bold and Green Text</option>
<option class="grey" value="text">Bold and Grey Background</option>
<option value="text">Bold Text Only</option>
</select>
</form>
</body>
</html>

Thanks,
Sean


p.s. Sweat - just a note, it's style="background-color:red;" as opposed to style="bgcolor:red;"
0
 
LVL 11

Expert Comment

by:SweatCoder
ID: 11956658
oh yeah. oops.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now