ajithredsmoke 0 Newbie Poster

I'm a newbie in programming.
I spent few hours yesterday and today working on a small AJAX page with multiple combo boxes that are populated from the database. I use IE6 99% of the time and I utilize the excellent . I almost done with the page (I’m pretty proud of it too) so I decided to show it to my work buddy. On both IE8 and opera, my beautiful double combo boxes just failed miserably. A part of what I was doing was to populate a double combo box with dynamic data from the database. I created an empty SELECT tag (dynamically via JS), assigned its an ID, made an AJAX request, then populated the empty SELECT tag via the innerHTML with the AJAX response, which is a list of OPTION elements. On IE6, the double combo works so well that I thought it was time wrap up the project. However, on other browsers, the combo box just mysteriously failed to get populated.

First of all, I tried to eliminiate the possibility of my AJAX requests got messed up somewhere. I traced through the flow of the functions and put alert() to assert the responses of the AJAX requests.Everything works fine except the second combo.

Here's the ajax code..

function selected()
 {
 //alert("entered in function");
	 
 	var xmlHttp;
	var str = document.form1.coursename.value;
	var bname = navigator.appName;
	var vname = bname + navigator.appVersion;
   
	alert(str);
	
	try
	{
		//alert(vname);
		//explorer 7+,firefox,safari,chrome,opera and others
		xmlHttp = new XMLHttpRequest();
		
		
	}
	catch(e)//for IE
	{
		try
		{
			//alert("ie6");
			//for explorer 6.0
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				//alert("ie>6");
				//explorer > 6
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
				
			}
			catch(e)
			{
				//explorer < 4
				alert("Ajax is not supported by your browser");
			}
		}
	}
	
	xmlHttp.onreadystatechange = function()
	{alert("entered in state changed");
		if(xmlHttp.readystate == 4)
		{	
			document.getElementById("subjectplace").innerHTML = xmlHttp.responseText;//subjectplace is the id of div tag
			alert("readystate=4");
		}
 	}
 xmlHttp.open("get","mypage.php?q="+str,true);
 xmlHttp.send(null);
 
 }

Any Kind of help will be appreciated..
Thanks in advance..