first commit
This commit is contained in:
44
test.html
Executable file
44
test.html
Executable file
@ -0,0 +1,44 @@
|
||||
<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 <20> 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>
|
Reference in New Issue
Block a user