473,385 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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
1 2101
It was something different. Please see my thread titled:

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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: David | last post by:
Can anyone give me a quick code snippet (that is standards-based) for adding OPTION tags to a SELECT dynamically. I have no problem doing it in IE but I am kind of new to the whole standards world...
13
by: RCS | last post by:
I have a UI that needs a couple of threads to do some significant processing on a couple of different forms - and while it's at it, update the UI (set textboxes, fill in listviews). I created a...
2
by: R Duke | last post by:
I have tried everything I can think of to change the visible property of a design time created control from a dynamically created control's command event handler. Here is the scenario. I have...
7
by: mef526 | last post by:
I would like to reference a dynamically created control and I know the name. I would like to use the following: Dim strName as String = "txtControl1" ' This is the ".Name" used when textbox was...
22
by: Saul | last post by:
I have a set of radio buttons that are created dynamically, after rendered I try loop thru this set by getting the length of the set, but I keep getting an error stating the element is undefined. I...
14
by: The Natural Philosopher | last post by:
This is a nasty one and I can't see my way out of it. I have a bunch of select statements in a form, and each select statement has an onchange="do_something(this)" in it, and this works...
1
by: Josh C. | last post by:
I am attempting to dynamically add an option to a select box when the box is selected (click or focus). This works fine using Firefox by either creating a new element and appending it to the...
5
by: Gregor Kofler | last post by:
Refactoring my old DualSelectBox , I thought it would be much smarter to get rid of the new Option() stuff, and instead just switch childNodes between the two select elements. Something like that:...
3
by: ton | last post by:
Hi, I'm using AJAXPRO this works very well. What I want to do is to add new page elements at my web site without using a postback. And I do not mean listitems but a complete dialog. Let me...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.