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. Advertisements

  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. Advertisements

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:
    1,164
    Martin Honnen
    Sep 19, 2006
  2. msimmons
    Replies:
    0
    Views:
    755
    msimmons
    Jul 16, 2009
  3. Jurjen de Groot
    Replies:
    0
    Views:
    550
    Jurjen de Groot
    May 19, 2008
  4. palmiere
    Replies:
    1
    Views:
    666
    Erwin Moller
    Feb 9, 2004
  5. JJA
    Replies:
    2
    Views:
    171
  6. Steve
    Replies:
    6
    Views:
    435
    Thomas 'PointedEars' Lahn
    Mar 5, 2008
  7. rvelosoo
    Replies:
    1
    Views:
    539
    Bart Van der Donck
    Aug 13, 2008
  8. skywalker skywalker
    Replies:
    4
    Views:
    3,024
    Evertjan.
    Jul 22, 2011
Loading...