Solved

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

Posted on 2004-09-01
5
292 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
Comment Utility
try style="bgcolor:red;" or style="color:red;"

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

Expert Comment

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

Expert Comment

by:pinaldave
Comment Utility
Hi SweatCoder,
 font-weight: bold;

Regards,
---Pinal
0
 
LVL 31

Expert Comment

by:seanpowell
Comment Utility
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
Comment Utility
oh yeah. oops.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
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…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

763 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

8 Experts available now in Live!

Get 1:1 Help Now