为什么我不能在ie中使用onChange?有没有解决方案?
HTML:
<select id="auto_doors" style="display:none;" name="auto_doors" onchange="updateField(this.value, 'auto_fuel', 5, 6, this.parentNode.id), resetBelow(4,'auto'), show('auto_fuel')">
</select>
功能:
if (jQuery.browser.msie) { setTimeout(DoSomething, 0); } else { DoSomething(); }
function updateField(str, id, prevvalue, value, vehicletype)
{
if (str=="")
{
document.getElementById(id).innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById(id).innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","inc/form_rest.php?q="+str+"&prevvalue="+prevvalue+"&value="+value+"&vehicletype="+vehicletype,true);
xmlhttp.send();
}