Try not using innerHTML
. IE historically does not allow you to innerHTML
everywhere you would think possible. Instead try slower, clunkier DOM methods .appendChild()
.
For example, have the PHP return JSON or XML with the value/text pairs you need, then when you AJAX it do something like this:
PHP output (aka your http.responseText
):
{value:"20100608",text:"date 1"},
{value:"20100609",text:"date 2"},
{value:"20100610",text:"date 3"},
{value:"20100611",text:"date 4"},
{value:"20100612",text:"date 5"}
JavaScript:
http.onreadystatechange = function(){
if(http.readyState == 4){
eval("var data = [" + http.responseText + "]");
for(var i=0;i<data.length;i++)
var t = document.createElement("option");
t.value = data[i].value;
t.innerHTML = data[i].text;
document.getElementById("entry_7").appendChild(t);
}
}
}
I am not sure why you are experiencing the problem you are, but I am guessing it has to do with the innerHTML
of a select
element in IE. Try my above method and I'm pretty sure it'll work.
I hope this helps in some way.
tau
2010-06-09 05:10:45