315920-4.html (835B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <style> 5 option {color: red} 6 option[disabled] {color: green} 7 option:disabled ~ option:not([disabled]):not(:disabled) {color: green} 8 option:not(:disabled):not([disabled]) + option:enabled {color: red} 9 </style> 10 </head> 11 <body onload='var elem0 = document.createElement("option"); 12 elem0.setAttribute("disabled", "disabled"); 13 var elem1 = document.getElementById("selection"); 14 elem1.insertBefore(elem0, elem1.firstChild); 15 document.getElementById("two").setAttribute("disabled","disabled");'> 16 <select size="4" id="selection"> 17 <option id="one">Should be no red</option> 18 <option id="two">Should be no red</option> 19 <option id="three">Should be no red</option> 20 </select> 21 </body> 22 </html>