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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change font colors in a drop down menu 1

Status
Not open for further replies.

cdunavent

IS-IT--Management
Aug 26, 2005
18
US
I have a standard drop down menu:

<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>

<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" U-File="file:///C:/Documents and Settings/Chris D/My Documents/My Webs/_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" --><p>
<select size="1" name="D1">
<option selected>.</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select></p>
<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

</body>

</html>



I would like to make the default font color of all the selections in the menu red. After someone makes a selection from this drop down menu, I would like to change the font color to green.

Can someone help me out??

-cd
 
try this:
Code:
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>

<script type="text/javascript">
function changeColors(sel) {
	if (sel.selectedIndex > 0) {
		sel.className = "green";
	}
	else {
		sel.className = "red";
	}
}
</script>

<style type="text/css">
.red option { color: #c00; }
.green option { color:#0c0; }
</style>

</head>

<body>

<form method="POST" action="--WEBBOT-SELF--">
  <!--webbot bot="SaveResults" U-File="file:///C:/Documents and Settings/Chris D/My Documents/My Webs/_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" --><p>
  <select size="1" name="D1" class="red" onchange="changeColors(this);">
  <option selected>.</option>
  <option>1</option>
  <option>2</option>
  <option>3</option>
  <option>4</option>
  </select></p>
  <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

</body>

</html>

-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
i like your sleeves...they're real big
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top