...

View Full Version : ListBox upgrade



Vladdy
02-07-2003, 06:06 PM
Someone on another forum was complaining about the inability of listbox to scroll horizontally and view long items, so I whipped up a little demo that replaces select elements (with size set to 2+) with a div element and hidden input element thus emulating the listbox control.
The code is IE only, but can easily be modified for Gecko compliance by rewriting event related routines.
The beauty of the approach is that in antique (NS4.*) and wannabe (Opera) browsers and others with JS disabled the select element is still there, so usability is not impacted at all.
In a div element that replaces the listbox all styles are customizable. Tooltips are implemented for items that exceed the box width.
The code can also be extended to include OPTGROUP recognition thus making the emulation complete.
It will also solve the problem with the IE bug that renders listboxes (and other controls) above everything, regardless of z-index setting.
The code was tested only in IE6.0 (I said, it's something I wipped up over the lunch hour) but should work with IE 5+.
Enjoy.

http://www.vladdy.net/tests/lbie.html

beetle
02-10-2003, 05:43 AM
That's pretty spifferrific there Vladdy! :thumbsup:

juwo
08-07-2003, 05:38 AM
can one do it for a combo box? I posted a query in the JavaScript forums



Originally posted by Vladdy
Someone on another forum was complaining about the inability of listbox to scroll horizontally and view long items, so I whipped up a little demo that replaces select elements (with size set to 2+) with a div element and hidden input element thus emulating the listbox control.
The code is IE only, but can easily be modified for Gecko compliance by rewriting event related routines.
The beauty of the approach is that in antique (NS4.*) and wannabe (Opera) browsers and others with JS disabled the select element is still there, so usability is not impacted at all.
In a div element that replaces the listbox all styles are customizable. Tooltips are implemented for items that exceed the box width.
The code can also be extended to include OPTGROUP recognition thus making the emulation complete.
It will also solve the problem with the IE bug that renders listboxes (and other controls) above everything, regardless of z-index setting.
The code was tested only in IE6.0 (I said, it's something I wipped up over the lunch hour) but should work with IE 5+.
Enjoy.

http://www.vladdy.net/tests/lbie.html

Vladdy
08-07-2003, 02:53 PM
I $$$$uppose ;)

Caffeine
08-07-2003, 09:03 PM
That is a nice script Vladdy :thumbsup:

I have seen a similar function in windows that works the same, and it is very useful.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum