Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

<SELECT> element 1

Status
Not open for further replies.

sparc20

Programmer
Mar 13, 2002
56
GB
I have a <SELECT> field within and HTML document. The <OPTIONS> are dynamically loaded from a DB and it might generate long titles. Unfortunatly i only want to have a specific width size for the <SELECT> element. Is there any way to set a width for this or is there anything i can use so it will not expant its size in extremely long titles in <OPTIONS> loaded from the DB??

THANX
 
Here is an example of that i mean

<FORM action=" <SELECT name="langpair" size="1" onChange="translate()">
<OPTION>Translate to:</OPTION>
<OPTION value="en|de">German</OPTION>
<OPTION value="en|es">Spanish</OPTION>
<OPTION value="en|fr">French</OPTION>
<OPTION value="en|it">Italian</OPTION>
<OPTION value="en|pt">This is an extremely long option which i want to avoid becouse it will change the layout of my website</OPTION>
</SELECT>
<INPUT type="hidden" name="u" value="<%=request.getRequestURL()%>">
</td>
<td>
</FORM>
 
Try this
Code:
<SELECT name="langpair" size="1" style="width:200;" onChange="translate()">


buffalo.gif

 

Unfortunately, you cannot guarantee that this will work in all browsers. Select box widths are automatically determind by some.

Maybe you'd be better off using radio buttons instead?

Hope this helps,
Dan
 

If you use the style trick, I'd test it on both popular Mac browsers and most popular IE browsers (so about 6 different brosers all up) to make sure it works before "going live" with the page. I've had some nasty surprises when assuming the width would never go over a certain size that way.

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top