Width of Listbox

I have a problem in controlling the width of a listbox in IE and Netscape.
In Netscape it takes the width of the default text specified.

In IE it increases with the length of the text I am loading dynamically. How do I set a fixed width for this control so that it behaves alike in both the browsers.

As and when I load the options for the listbox, the width varies wrt the text.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

salurAuthor Commented:
Adjusted points to 40
Yep, you are right, you can only have 3 posibilities:

1.- Before the creation of the listbox you can count the max length of the options, set the longer as selected and in the onload() select the right one.

2.- Use an style to create it as the size you want:

<select name="example" size="1" style="width: 40mm">
<option ....></option>

3.- Use &nbsp; in the options to adjust the size.


PS: Merry X-mas


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
salurAuthor Commented:
Thanks a lot xabi. Its fine now....

Merry Christmas
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.