Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > OPTION elements added to a dynamically created SELECT box via DOM are not visible in IE

Reply
Thread Tools

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

 
 
Robert Oschler
Guest
Posts: n/a
 
      09-03-2005
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.


 
Reply With Quote
 
 
 
 
Robert Oschler
Guest
Posts: n/a
 
      09-03-2005
It was something different. Please see my thread titled:

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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Affecting a dynamically created drop down from another dynamically created drop down. msimmons ASP .Net 0 07-16-2009 03:17 PM
adding elements created by DOM doesnot show up when added to Horizontal Panel dheerajsah@gmail.com XML 4 09-19-2006 02:17 PM
Managing ViewState of a dynamically created Custom Composite Server Control -(where the original is also dynamically created) dickster ASP .Net Building Controls 0 12-08-2005 09:32 AM
How to change WIDTH of empty SELECT box with no dynamic elements added JJA Javascript 2 10-13-2004 07:16 PM
select of select box will select multiple in another box palmiere Javascript 1 02-09-2004 01:11 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57