Solved

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

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
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 code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

726 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