"comp.lang.javascript" wrote:
Using IE5.5+, is it possible to hide options in a select?
The following doesn't work:
<HTML>
<HEAD>
<STYLE>
SELECT OPTION.orgA{ display:none }
.orgB{ display:inline }
.orgC{ display:none }
</STYLE>
</HEAD>
<BODY>
<SELECT id=cbo size=3>
<OPTION class="orgA">RTI</OPTION>
<OPTION class="orgB">LAB</OPTION>
<OPTION class="orgC">TCI</OPTION>
</SELECT>
</BODY>
</HTML>
Best Regards,
Jesse Wade
If you want to have items dynamically appear and disappear from a
<select> you're going to have to remove the references to the
actual <option> objects and recreate them when you want them
"visible":
document.getElementById{'cbo').options[1] = null;
var select = document.getElementById('cbo');
select.options[select.option.length] = new Option(...);
Of course that adds it to the bottom, if you want it added at the
cursor position or in sorted order, you'll have to re-order the
<option> objects after you add the new ones.
--
| Grant Wagner <gw*****@agricoreunited.com>
* Client-side Javascript and Netscape 4 DOM Reference available
at:
*
http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
*
http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
*
http://www.mozilla.org/docs/web-deve...upgrade_2.html