Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Color changes for combobox 1

Status
Not open for further replies.

bburnell

Programmer
Sep 15, 2000
560
US
Anyone know what the javascript is (or example) that I could use to change the background color of a combobox based on the value selected?

i.e. "Fail" = red
"Pass" = green

I am using asp.net and vb.net 2003 for the combobox.

Thanks!
Brett
 
No javascript necessary, just CSS:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<title>title test</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<script type="text/javascript"></script>
<style type="text/css"></style>
</head>
<body>

<select>
   <option style="background-color:red; color:white">Red Background</option>
   <option style="background-color:green; color:white">Green Background</option>
</select>

</body>
</html>

-kaht

Looking for a puppy? [small](Silky Terriers are hypoallergenic dogs that make great indoor pets due to their lack of shedding and small size)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top