Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language

Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Ajax Programming

AJAX Internet Explorer display problem

I am having problems with populating select dropdowns from get and post
requests in Internet Explorer.  This problem does not occur in Firefox.

Example Scenario:
Form with 2 dropdowns and a submit button.
One dropdown is populated via a database query, and the data never
The second dropdown is populated depending on the selection of the
first dropdown.

I then make a selection in both dropdowns and post the form.  Once the
page reappears, the first dropdown is populated, but the second
dropdown is not.  However, if I put an alert just prior to changing the
selectedIndex of the second dropdown, then the second dropdown will
populate with the posted value.  Thus, the value and index are retained
from the post, but the dropdown selectedIndex does not update unless
the alert appears.

Again, this problem only exists in Internet Explorer.  I have set all
pages to nocache.  My xml url requests all have a timestamp as well.

Please provide any help.


IE doesn't support the innerHTML property of <select> elements, maybe
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.


Actually, I can add "alert('foo');" or any alert, and the selectedIndex
is updated.


Shouldn't that be
control.options.selectedIndex = index
when using IE?


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.


On 11/13/06, redstick <sean.marsh@gmail.com> wrote:


The setTimeout solved my problems.  Thank you for the suggestion.


Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc