By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,566 Members | 1,894 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,566 IT Pros & Developers. It's quick & easy.

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

P: n/a
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.
Sep 3 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
It was something different. Please see my thread titled:

DOM: Properties set before calling appendChild() are lost after call
Sep 3 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.