Solved

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

Posted on 2004-09-01
5
301 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
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ā€¦
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

685 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