OPTION elements added to a dynamically created SELECT box via DOM are not visible in IE

R

Robert Oschler

The code below works great in Mozilla.

In IE the selection box is created, and there is a drop-down box if I click
on the down arrow, but I can't see the OPTION text for each option. The
options are invisible, yet the box seems fully functional. I went into the
debugger and sure enough the selection box has "OPTION" child nodes with the
correct "value" and "text" attributes.

What could be wrong?:

------------------------------

selectBox=document.createElement("SELECT");
selectBox.name=selectBox.id="choose1";
selectBox.style.width=100;
selectBox.style.backgroundColor="#CCCCFF";

var oneOption=document.createElement("OPTION");
oneOption.value=1;
oneOption.text="one";
selectBox.appendChild(oneOption);

document.body.appendChild(selectBox);
------------------------------

Also, buttons I create in IE dynamically using DOM and give a known CSS
class name, don't seem to respect the class name (they don't adopt the CSS
style attributes). This works fine in Mozilla.

Any thoughts?

Thanks.
 
R

Robert Oschler

It was something different. Please see my thread titled:

DOM: Properties set before calling appendChild() are lost after call
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top