views:

77

answers:

1

Hi all,

I got a javascript code I wrote that calls a web service returns some data and populate the results in a combo box. However I ran into a problem where the ordering of items for the combo box is upside down in Google Chrome. In other browser such as IE and Opera it is in its order from the way the script populate the list of items.

I like to know is this a known issue with chrome itself or is it the way how chrome handles javascript.

Thanks.

Edit: This is the fucntion I call to add items to the combo box

function addItemToDropList(comboBox, text, value) {
var dropListItem = document.createElement('option');
dropListItem.text = text;
dropListItem.value = value;

try
{
    comboBox.options.add(dropListItem, null);
}
catch(e)
{
    comboBox.options.add(dropListItem);
}    

}

A: 

I'm assuming the comboBox variable in your code snippet is the <select> element. If so, you should be able to use this:

comboBox.appendChild(dropListItem);
nickf
Ah, That works thanks for the help
madness800