3 replies [Last post]
Skychan
Offline
newbie
Last seen: 7 years 42 weeks ago
Joined: 2006-10-06
Posts: 2
Points: 0

I want the selected option in the un-dropped view of the box to be dynamically changed to the same color as the background color of the selected option. That make sense? here is the code, the expression() part is the only part that seems to fail oddly.

<select name="surveyColor" style="background-color: expression(surveyColor.options[surveyColor.selectedIndex].value);">
  <option value="lightBlue" style="background-color: lightblue;">Blue</option>
  <option value="pink" style="background-color: pink;">Pink</option>
  <option value="lightGreen" style="background-color: lightgreen;">Green</option>
  <option value="yellow" style="background-color: yellow;">Yellow</option>
</select>

any insights would be great! thx ^_^

//bbcode added --gary/kk5st/mod

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 6 hours 44 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9149
Points: 3133

The expression() value is an

The expression() value is an IE proprietary value, and not generally supported. As used, I would guess that when the javascript expression is read, the value is not yet defined. It should throw an error.

I don't have any debugging tools for IE, and Firefox would properly ignore it. So, I can't help further.

cheers,

gary

Unplanned code results in a tangled wad of brain-cramping confusion.

There are enough html & css demos and tutorials to be interesting. Please visit.

Skychan
Offline
newbie
Last seen: 7 years 42 weeks ago
Joined: 2006-10-06
Posts: 2
Points: 0

ah yes, thank you. I was

ah yes, thank you. I was just testing in FireFox so that explains it. The expression placed in javascript works perfectly but placed as an expression in CSS it only works in IE and not firefox.

So there is no other way to create dynamic CSS?

thx

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 6 hours 44 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9149
Points: 3133

Attach an onchange event

Attach an onchange event handler to select?

cheers,

gary

Unplanned code results in a tangled wad of brain-cramping confusion.

There are enough html & css demos and tutorials to be interesting. Please visit.