Solved

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

Posted on 2004-09-01
5
302 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

734 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