I am currently attempting to setup a form <select> object that, when clicked on will display the options in a different color, then revert back to white when an option is chosen. I am using the following code:
<form name="form1>
<select name="ManID" onFocus="this.style.backgroundColor='e8e2c6'" onBlur="this.style.backgroundColor='ffffff'">
<option selected value="Any"> </option>
<option value="manufacturerID">ManufacturerName
<option value="manufacturerID2">ManufacturerName2
</select>
</form>
However, it is very quirky, and doesnt change the color until you;ve either clicked on the pulldown first or you click on the pulldown and scroll throguh (focusOn) the options.
I have also tried the following javascript:
<script language="javascript">
function manOnColor(){
for (i = 0; i < document.form1.ManID.length; i++) {
document.form1.ManID.style.background='e8e2c6'}
}
function manOffColor(){
for (i = 0; i < document.form1.ManID.length; i++) {
document.form1.ManID.style.background='ffffff'}
}
</script>
As well as applying the onfocus, onblur to the option fields themselves and trying onChnage... Any ideas?
<form name="form1>
<select name="ManID" onFocus="this.style.backgroundColor='e8e2c6'" onBlur="this.style.backgroundColor='ffffff'">
<option selected value="Any"> </option>
<option value="manufacturerID">ManufacturerName
<option value="manufacturerID2">ManufacturerName2
</select>
</form>
However, it is very quirky, and doesnt change the color until you;ve either clicked on the pulldown first or you click on the pulldown and scroll throguh (focusOn) the options.
I have also tried the following javascript:
<script language="javascript">
function manOnColor(){
for (i = 0; i < document.form1.ManID.length; i++) {
document.form1.ManID.style.background='e8e2c6'}
}
function manOffColor(){
for (i = 0; i < document.form1.ManID.length; i++) {
document.form1.ManID.style.background='ffffff'}
}
</script>
As well as applying the onfocus, onblur to the option fields themselves and trying onChnage... Any ideas?