views:

38

answers:

0

The dropdown menu are not populating via ajax in IE6. They are working fine every browser except IE6.

My snippet of code can be found as follows:

function GetXmlHttpObject()

{
var xmlHttp=null;
try
 {
xmlHttp=new XMLHttpRequest();
  alert('simple'+xmlHttp);
 }
catch (e)
 {
 try
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
   alert('Msxml2.XMLHTTP.6.0 here '+xmlHttp);
  }
 catch (e)
  {
  try{
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP.3.0");
   alert('Msxml2.XMLHTTP.3.0 here '+xmlHttp);
  }catch(e){
  try{
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
   alert('Msxml2.XMLHTTP here '+xmlHttp);
  }catch(e){
  alert('This browser does not support XMLHttpRequest');

  }
  }
  }
 }
return xmlHttp;
}

function changefirst()
        {
            //document.getElementById('containerSB2').style.display = 'block';
            var va1 = document.login.section.options[document.login.section.selectedIndex].value ;

            if(va1!="Select Education Stream")
            {
                xmlHttp=GetXmlHttpObject()
                //document.getElementById('containerSB2').innerHTML = xmlHttp.responseText;
                if (xmlHttp==null)
                {
                    alert ("Browser does not support HTTP Request")
                    return
                }
                var url="getuser.jsp"

                url=url+"?emp_id="+va1;

                xmlHttp.onreadystatechange=stateChanged
                xmlHttp.open("GET",url,true)
                xmlHttp.send(null)
            }
        }

        function stateChanged()
        {


            if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
            {

                var showdata = xmlHttp.responseText;


                var strar = showdata.split(":");
                var select = document.getElementById("ename");
                select.options.length = 1;
                for(i=strar.length-1;i>0;i--)
                {


                    var ch=strar[i].length;
                    //alert('one'  +ch);
                    var  ch1=strar[i].indexOf(",");
                   // alert('one'  +ch1);
                    var  ch2=strar[i].substr(0,ch1);
                   // alert('one'  +ch2);
                    var ch3=strar[i].substr(ch1+1,ch);
                   // alert('one'  +ch3);
                    select.options[select.options.length]= new Option(ch3,ch3);


                }
            }


        }

Kindly help... In IE6 the alert prints:

"Msxml2.XMLHTTP.6.0 here";