IEは右のそれを取得;)
は、それが他のブラウザで動作するためにあなたは、いくつかのJavaScriptをする必要があります:
<select onchange="this.style.backgroundColor=this.options[this.selectedIndex].style.backgroundColor">
<option style="background-color:yellow">Item 1</option>
<option style="background-color:lightyellow">Item 2</option>
</select>
<select
onchange="this.className=this.options[this.selectedIndex].className"
class="important">
<option class="important" selected="selected">Item 1</option>
<option class="sorta-important">Item 2</option>
</select>
そして、あなたのCSS:
.important { background-color:yellow; }
.sorta-important { background-color:lightyellow; }
CSSクラス名でさえ、よりよいです
あなたのプレゼンテーションの詳細を別々にし、あなたのクラス名を意味のあるものにします。
おかげで、。 –