Feedback on: irt.org FAQ Knowledge Base Q858
Worth:
Worth reading
Length:
Too short
Technical:
Just right
Comments:
Although this was a reasonable answer, it was not technically correct when it stated that it is not possible to limit the width of a select box in Netscape.
To do this you must populate the select box using Javascript. You can specify a WIDTH attribute which will specify the width in pixels (although this is not such a good idea), or you can put one dummy <OPTION> entry which is the width you want. Then you delete the option using Javascript and add all the options you wish to appear in the list. The select box will be forced to stay the size of the original (dummy) entry.
Note: This will not work on IE, so you would need to also include the STYLE specification in the SELECT tag for IE.
--
Amos Bannister
Worth:
Worth reading
Comments:
You could also do a mid function on the option text value to reduce the width.
Comments:
you can do this in the 6+ browsers using css properties
i.e
<SELECT NAME=\"selectme\" style=\"width:350">
Worth:
Worth reading
Comments:
The ideas presented here do not work if you are trying to keep the SELECT box a certain size and are dynamically populating the box.
Both IE 5.5 and Netscape 6 will make the SELECT box wide enough for the widest OPTION if you dynamically add OPTIONs.