this prgram working in ie well but in mozilla mma() ajax function working the second one not working in mozilla..

plz help me

function getHTTPObject()
  {
	if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
	
	else if (window.XMLHttpRequest) return new XMLHttpRequest();
	else 
	{
		
	alert("Your browser does not support AJAX.");
	return null;
	}
  }
 


  function hsc(va2)
   {

	   var zs,zs1,y1,y2,zz,z1,y3;
	   zs=va2;

       y1=document.getElementById(zs).src;
       y2=y1.match("minus_symbol.gif");
	   y3=y1.match("plus_symbol.gif");
       zs1= zs.split("img");	
				 zz=zs1[1];
    if(y2=="minus_symbol.gif") //second one 
    	{ 
						
			 z1='ct='+zz;
			  b="img"+zz; 	
    url ="get_catname.php";
	objXMLHTTP1 = getHTTPObject();
    objXMLHTTP1.open("POST",url,true);

objXMLHTTP1.onreadystatechange = stateChanged;

	objXMLHTTP1.setRequestHeader('content-type','application/x-www-form-urlencoded');
	objXMLHTTP1.send(z1);
            function stateChanged()
                {
                       if (objXMLHTTP1.readyState==4)
							{
							   document.getElementById(zz).innerHTML="";
                               document.getElementById(zz).innerHTML=objXMLHTTP1.responseText;
							   document.getElementById(b).src="images/plus_symbol.gif";
							   
							}
                 }  
       }
    if(y3=="plus_symbol.gif")
	   {
    
              mma();       //first one
       }

   function mma()
   {
    b="img"+zz;
	z='ct='+zz;
    url ="get_subcategname.php";
	objXMLHTTP = getHTTPObject();
    objXMLHTTP.open("POST",url,true);
	objXMLHTTP.onreadystatechange = stateChanged;
    objXMLHTTP.setRequestHeader('content-type','application/x-www-form-urlencoded');
	objXMLHTTP.send(z);
        
            function stateChanged()
                {
                       if (objXMLHTTP.readyState==4)
							{
                               m=document.getElementById(zz).innerHTML;
							   document.getElementById(zz).innerHTML=m+objXMLHTTP.responseText;
							   document.getElementById(b).src="images/minus_symbol.gif";
							    document.getElementById('apDiv10').innerHTML="";


							   
							}
                 }   
    }
	   }

Why do u have two function stateChanged() and why do u have a function within a function?

I suggest get rid of the second stateChanged() function.

Download firebug for firefox, great tool for debugging.

This article has been dead for over six months. Start a new discussion instead.