[thelist] Multi dynamic select boxes and IE

Peter-Paul Koch pp.koch at gmail.com
Wed Jan 5 08:48:00 CST 2005


> I've made a script which dynamically turns multi select boxes into 2
> separate ones to make selecting things easy.
> This is generated on the fly via DOM manipulation (so non-JS users get a
> standard one) and works well. However, in IE, when the page loads it
> shows the 2nd select box as a normal one - not a multiple select one.
> 
> A cut down version which just adds the select box to the page
> demonstrates this issue (bug?) nicely, and shows that it isn't something
> else in the script which is causing it.
> http://livsey.org/select/index2.html
> 
> When the page loads, the select box is a standard one. I've added an
> onfocus action to the select box which adds an option to it. When you
> click it, it magically turns into a multi select box.

Apparently IE Windows only recognizes the multiple attribute
onFocus(), which, as far as I'm concerned, is a bug. The solution is
therefore to place the focus on the select box automatically:

form.appendChild(select);
select.focus();

After that you might put the focus on the first, normal, select.

-- 
-------------------------------------------------------------------
ppk, freelance web developer

Bug Report: Report bugs yourself, or comment on previously 
reported ones.
http://www.quirksmode.org/bugreports/
------------------------------------------------------------------


More information about the thelist mailing list