[Javascript] Select Box - List Style
Roger Roelofs
rer at datacompusa.com
Mon Jun 14 12:46:12 CDT 2004
Dave,
On Jun 14, 2004, at 1:01 PM, Dave Stoltz wrote:
> Thanks!
>
> But the only problem with that is, if I populate the listbox with a
> long
> string, it won't stretch...
> I guess I can't have my cake and eat it too....:)
>
> -----Original Message-----
>
> Dave,
>
> You can use the CSS width attribute to tell the box how wide you
> want it to be, e.g.
> <select style="width:300px;">
>
> Cheers,
> Peter Brunone
>
> -----Original Message-----
> From: javascript-bounces at LaTech.edu On Behalf Of Dave Stoltz
>
> If I have an empty select box in the list style (not dropdown), it
> appears
> very narrow...
> Is there any way you can make an empty select box have an initial
> width?
You can do it via javascript. After you fill the options array, loop
through the options, count the number of characters in each option.text
and set the width of the select in ems based on the number of
characters in the longest option.
If you need code, let me know.
Roger
-------------------------------------------------------
Roger Roelofs web www.datacompusa.com
Datacomp Appraisal Services web www.mhvillage.com
3215 Eaglecrest Drive, NE Email rer at datacompusa.com
Grand Rapids, MI 49525-4593
More information about the Javascript
mailing list