I'm not sure exactly what the problem is, but I might try an approach  
that does not use innerHTML if possible as I think it simplifies the  
code.  The example I put together is kind of long, so rather than  
including it, you can view it here:

http://cantrell.dyndns.org/~cantrell/tmp/selectTest.html

Just view the source to see the JavaScript.

Cantrell

On Saturday, December 21, 2002, at 10:53 AM, Robert Polickoski wrote:

> All,
>
> Thank you for your indulgence.
>
> I am trying to dynamically set the options of a select based on
> the option selected in a previous select.  The javascript code for
> a particular case is thus:
> for (i=1; i<Process.length; i++)
> case "8":
> {
>       for (i=1; i<Process.length; i++)
>       {
>               document.getElementById("selectDoIndex").innerHTML
> = document.getElementById("selectDoIndex").innerHTML + "<option
> id='optionProcess" + Process[i]['Index'] + "' title='Option " +
> Process[i]['ID'] + ", " + Process[i]['Description'] + "' value='"
> + Process[i]['Index'] + "'>" + Process[i]['Name'] + "</option>";
>       }
>       break;
> }
>
> The select element it is referencing is:
> <select id="selectDoIndex" name="DoIndex" title="The specific
> Thing to Do" size="1">
>       <option id='optionSelectDoIndexDefault' title='Default for
> Select Do Index' value=''>Select...</option>
> </select>
>
> The problem is that on the first iteration through the loop it
> chops off the opening <option> tag of the pre-existing entry
> leaving only Select...</option> plus the full entry of that
> iteration.  I have tried setting a variable to the existing
> innerHTML plus the new and it contains what I want before I set
> the select.innerHTML to it.  Afterwards it contains everything but
> the initial opening <option> tag.  Does somebody know a way around
> this annoying "undocumented feature?"
>
> Again thank you.
>
>
> Robert J. Polickoski
> Senior Programmer, ISRD Inc.
> (540) 842-6339
> [EMAIL PROTECTED]
> AIM - RobertJFP
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Reply via email to