InnerHTML drops leading tag in SELECT

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I am relatively new to XMLRequest, DOM and Ajax but I really like the
functionality. I have the DIV and SPAN changes working well but I
thought that I would experiment with changing the actual innerHTML of
each control rather than changing the whole control inside of a DIV.

What I tried was this:
Create a <SELECT> so...

<SELECT id=MyComboBox>
<OPTION>opt1</OPTION>
<OPTION>opt2</OPTION>
<OPTION>opt3</OPTION>
</SELECT>

I then tried to change the innerHTML of just "MyComboBox" but when I
view the resulting string that is supposed to populate the SELECT it
is always missing the first <OPTION> tag. In other words, the string
is supposed to look like this:
strFill = "<OPTION>new1</OPTION><OPTION>new2</OPTION><OPTION>new3</
OPTION>"

....but, instead, it looks like this:
strFill = "new1</OPTION><OPTION>new2</OPTION><OPTION>new3</OPTION>"

I even tried forcing a leading string on the beginning like this...
strResult = "<OPTION>" + strFill;
but it still strips off the leading OPTION tag when I pop the SELECT
(ie. MyComboBox.innerHTML = strResult;)
I checked the innerText property of the result and it looks fine.

Is there something that I am missing or is there an easier way to do
this?
Anyway, until I hear from someone, I guess that it is back to the DIV/
SPAN thing.

Thanks for the help.
Mark

.



Relevant Pages

  • Re: Color row of DBGrid
    ... S: string; ... StringGrid.Canvas.TextHeight) div 2; ... TextTop and TextLeft are only to center the text. ...
    (comp.lang.pascal.delphi.misc)
  • Re: InnerHTML drops leading tag in SELECT
    ... I have the DIV and SPAN changes working well but I ... each control rather than changing the whole control inside of a DIV. ... I then tried to change the innerHTML of just "MyComboBox" but when I ...
    (microsoft.public.dotnet.framework.aspnet)
  • Javascript printing question? Using C# , ASP.NET & Oracle
    ... This is a javascript is not being used. ... I just want to print the string. ... <DIV> ... OdbcDataAdapter(strSQLDDL, myConnection); ...
    (microsoft.public.dotnet.languages.csharp)
  • Creating a dynamic file link
    ... item was contained in it's own hidden <div>. ... Dim fn As String = Request.QueryString ... Dim fp As StreamReader ... the variable udf causes the test.txt file to be ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Creating a dynamic file link
    ... In the past I had an HTML page that contained a lot of code items and each ... item was contained in it's own hidden <div>. ... string to load the contents of a text file into a div. ... Dim fp As StreamReader ...
    (microsoft.public.dotnet.framework.aspnet)