[thelist] Multi dynamic select boxes and IE

Richard Livsey richard at livsey.org
Wed Jan 5 07:13:43 CST 2005


Hi all, happy 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 demo of this is available here:
http://livsey.org/select/index.html

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.

The basic JS is as follows:

var select = document.createElement('SELECT');
select.multiple = true;
var form = document.getElementById('testForm');
form.appendChild(select);

Anyone any ideas on why it's doing this, and am I missing something that 
IE needs to display it as a multi select box from the get go?

I've googled about and can't see anything obvious.

Thanks in advance.

-- 
R.Livsey
Incutio Web Developer
www.livsey.org
www.incutio.com




-- 
R.Livsey
Incutio Web Developer
www.livsey.org
www.incutio.com



More information about the thelist mailing list