versuche das hier:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><head><title></title>
<style type="text/css">
option[disabled] { color:lightgrey; }
.disabled { color:lightgrey; }
</style>
<script type="text/javascript">
<!--
var sel_1_default = 0;
function test()
{
if(document.getElementById("sel_1")[document.getElementById("sel_1").selectedIndex].getAttribute("disabled")==true) document.getElementById("sel_1").selectedIndex = sel_1_default;;
}
//-->
</script>
</head>
<body>
<form action="">
<select id="sel_1" onchange="test()">
<option>Heino</option>
<option>Michael Jackson</option>
<option disabled="true" class="disabled" >Tom Waits</option>
<option>Nina Hagen</option>
<option>Marianne Rosenberg</option>
</select>
</p>
</form>
</body>
</html>
noch ev. zu verbessern/anzumerken:
- merken des letzten gültigen eintrages anstatt default-wert
- die erste CSS-formatierung ist CSS 2.0 und wird erst vom IE 7.0 unterstützt. besser also die class methode verwenden...
- und die funktion variabel für mehrere listen gestalten