
September 20th, 2005, 08:19 AM
|
|
Member
|
|
Join Date: Feb 2003
Location: Yerevan, Armenia
Posts: 224
Time spent in forums: 21 h 1 m 30 sec
Reputation Power: 11
|
|
|
<select> innerHTML problem
Hi everyone,
Ok, what I'm trying to do is use the innetHTML property of a <secelct> box to change it's contents. What I do is generate a string with a list of <option> tags and then use
document.getElementById("mybox").innerHTML = s;
to fill the select box.
Now it doesn't work, particularily, the contents of the select box are displayed in a single string. When it should have been 3 items like
item1
item2
item3
it's really one item showing in the drop down menu:
item1item2item3
Now I looked at the contents of the string before putting it into the innerHTML and at the innerHTML after assigning the string to it. It looks pretty wierd. The string at first seems right
<option value=1>item1</option><option value=2>item2</option>
but after inserting the innerHTML contains something like
item1</option><option value=2>item2</option>
lacking the first opening option tag.
Does anyone have an idea as to what's the problem here and how it can be fixed?
__________________
You'll live, only the best get killed.
--Charles De-Gaulle
|