[Sigia-l] Another html form question...

Listera listera at rcn.com
Mon Jan 26 23:39:42 EST 2004


"Chris Chandler" wrote:

> I have a fixed width drop down box in which there are 20+ selections. Some of
> the selections are quite long and are cut off in the drop down box. The
> selections are trademarked names, and the fact that they are cut off is
> causing some consternation.

That's fairly trivial:

If you're dynamically generating these then items then add a method to count
the number of characters in the longest entry while the select list/array is
being generated server side or client side via JS. Considering the fonts you
assigned to the select list in the CSS definition, calculate how many pixel
should the width be. You already know the minimum width you want to assign.
Then use these:

<select name="myDropDown" id="myDropDown" onmouseover="extendMe();"
onmouseup="contractMe();">

function contractMe() {
document.getElementById("myDropDown").style.width ="YourMinValuepx";
}

function extendMe() {
//alert("Down");
document.getElementById("myDropDown").style.width ="YourMaxValuepx";
}

This will expand the list when the cursor goes in and contract it to the min
value when the mouse leaves the area.

Enjoy.

----
Ziya

Simplicity is the ultimate sophistication.







More information about the Sigia-l mailing list