44 lines
1.3 KiB
HTML
Executable File
44 lines
1.3 KiB
HTML
Executable File
<html>
|
|
<head>
|
|
</head>
|
|
<body onload='ativaOptionsDisabled()'>
|
|
|
|
<select size=3>
|
|
<option>option 1</option>
|
|
<option disabled="'disabled'">option 2</option>
|
|
<option>option 3</option>
|
|
</select>
|
|
|
|
|
|
<!--[if lte IE 7]>
|
|
<script>
|
|
function ativaOptionsDisabled(){
|
|
var sels = document.getElementsByTagName('select');
|
|
for(var i=0; i < sels.length; i++){
|
|
sels[i].onchange= function(){ //pra se mudar pro desabilitado
|
|
if(this.options[this.selectedIndex].disabled){
|
|
if(this.options.length<=1){
|
|
this.selectedIndex = -1;
|
|
}else if(this.selectedIndex < this.options.length - 1){
|
|
this.selectedIndex++;
|
|
}else{
|
|
this.selectedIndex--;
|
|
}
|
|
}
|
|
}
|
|
if(sels[i].options[sels[i].selectedIndex].disabled){
|
|
//se o selecionado atual é desabilitado chamo o onchange
|
|
sels[i].onchange();
|
|
}
|
|
for(var j=0; j < sels[i].options.length; j++){ //colocando o estilo
|
|
if(sels[i].options[j].disabled){
|
|
sels[i].options[j].style.color = '#CCC';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
window.attachEvent("onload", ativaOptionsDisabled)
|
|
</script>
|
|
<![endif]-->
|
|
</body>
|
|
</html> |