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

Discussion in 'Javascript' started by Robert Oschler, Sep 3, 2005.

  1. 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.
    Robert Oschler, Sep 3, 2005
    #1
    1. Advertising

  2. It was something different. Please see my thread titled:

    DOM: Properties set before calling appendChild() are lost after call
    Robert Oschler, Sep 3, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    980
    Martin Honnen
    Sep 19, 2006
  2. msimmons
    Replies:
    0
    Views:
    452
    msimmons
    Jul 16, 2009
  3. palmiere
    Replies:
    1
    Views:
    379
    Erwin Moller
    Feb 9, 2004
  4. JJA
    Replies:
    2
    Views:
    97
  5. rvelosoo
    Replies:
    1
    Views:
    316
    Bart Van der Donck
    Aug 13, 2008
Loading...

Share This Page