PDA

View Full Version : Change the color of one option in a select box?


Shane
19.05.2001, 17:13
Is it possible to change the color of just one of the options in a select box? I would like to gray out a size when that size is not available. I am using asp to write the html, but a font tag around an option or the text itself is not rendered.
Thanks

//ShAnE

DCage
19.05.2001, 17:29
Yeah, but not with NN4:

<html>
<head><title></title>
<script>
function doIt(){
document.form0.elements[0].options[1].style.backgroundColor='ff0000';
}
</script>
</head>
<body>
<form name="form0">
<select>
<option>one
<option>two
<option>three
</select>
</form>


click ("")
</body>
</html>

Shane
19.05.2001, 17:49
Thanks DCage....
Unfortunately it is being done on an e-commerce site and I don't think the client would like it to work for one browser and not the other <img src=icon_smile_tongue.gif border=0 align=middle>. Funny right after I posted that I thought about accessing the option with javascript like that, but wasn't sure anyway.
Thanks

//ShAnE