I am trying to get the values to a select list for subcategories on the basis on what is chosen in categories select list. It doesn’t seem to work on IE. Can anyone suggest the problem?
my code correct work in firefox , Chrome , Opera And Safari
but not work in IE7,8,9 !!
js code :
<!-- Begin CHack For Ostan -->
function getOstan(str)
{
if (str.length==0)
{
document.getElementById("SH_O").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("SH_O").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","listing.php?q="+str,true);
xmlhttp.send();
}
<!-- END -->
<!-- Begin CHack For City -->
function getSH_O(str)
{
if (str.length==0)
{
document.getElementById("SH_C").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("SH_C").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","listing.php?z="+str,true);
xmlhttp.send();
}
<!-- END -->
in FF :

if IE :

Bu you should consider to use a library that will do the job for you, like jQuery (tested, cross-browser, etc.)