| re: How to change WIDTH of empty SELECT box with no dynamic elements added
"JJA" wrote[color=blue]
> I would like to know how to expand the width of SELECT boxes with
> Javascript. These have the MULTIPLE attribute and a SIZE attribute
> greater than 1 (usually around 10 or so).[/color]
Strange. In my observation 4 to 6 seems to be the most favourite size.
[color=blue]
> I've observed that the overall width of the SELECT element seems to be
> equal to the width of the entry with the most text.
> How can set the width with Javascript?[/color]
You create a reference to the select element, by means of its name or
document.getElementsByTagName('select')[index_number] and then set the width
attribute of its style object. For example:
myselectreference.style.width='10em';
In CSS it is even easier, and it even works with javascript off:
<select style="width:10em;"></select>
[color=blue]
> When I have no entries, the box looks strangely narrow.[/color]
Then there should no select element at all, I would think, but instead a
message explaining its absence.
--
Ivo |