that's your problem.
I don't reference the innerHTML property when changing options in the
select element. Once the select element is populated, I then change
the selectedIndex property of the element. Again, Internet Explorer
will move to the correct select element index if I put an alert just
prior to changing the selectedIndex. However, if this alert does not
exist, then the index does not change.
Here is the code snippet that I use to change the current option in the
select element:
if ((pageLoad == 1) && (getQueryParameter('eqStockIndex_1') != -1) &&
(control.id == 'selEquip_1')) {
index = getQueryParameter('eqStockIndex_1');
control.selectedIndex = index;
}
getQueryParameter is a function that returns the value of a given
parameter in a query string. If I add the following statement just
prior to the "control.selectedIndex = index;" statement, then the
selectedIndex will change.
alert(index);
Actually, I can add "alert('foo');" or any alert, and the selectedIndex
is updated.
-----------------------------------------------Reply-----------------------------------------------
Shouldn't that be
control.options.selectedIndex = index
when using IE?
-----------------------------------------------Reply-----------------------------------------------
Sounds like you are calling it before the options are rendered. You may want
to add a slight pause with setTimeout maybe a 100 milliseconds.
Eric
On 11/13/06, redstick <sean.marsh@gmail.com> wrote:
> I don't reference the innerHTML property when changing options in the
> select element. Once the select element is populated, I then change
> the selectedIndex property of the element. Again, Internet Explorer
> will move to the correct select element index if I put an alert just
> prior to changing the selectedIndex. However, if this alert does not
> exist, then the index does not change.
> Here is the code snippet that I use to change the current option in the
> select element:
> if ((pageLoad == 1) && (getQueryParameter('eqStockIndex_1') != -1) &&
> (control.id == 'selEquip_1')) {
> index = getQueryParameter('eqStockIndex_1');
> control.selectedIndex = index;
> }
> getQueryParameter is a function that returns the value of a given
> parameter in a query string. If I add the following statement just
> prior to the "control.selectedIndex = index;" statement, then the
> selectedIndex will change.
> alert(index);
> Actually, I can add "alert('foo');" or any alert, and the selectedIndex
> is updated.
Eric,
The setTimeout solved my problems. Thank you for the suggestion.
Sean