firefox not detecting the form elements

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • omerbutt
    Contributor
    • Nov 2006
    • 638

    firefox not detecting the form elements

    hi i am making a intranet online test application for a school and for that i have to make a form for creating the test the logic is to select a subject and then the number of questions for that test initially there are only 2 select elements in the form namely the ,
    subjects and the totalQuestions
    when it selects the choice in the totalQuestions dropdown
    it calls an onchange function makeAnswere(cho ice,rowId) which checks if the choice is,
    1.multiple choice question
    2.true/false
    3.yes/no

    if it is multiple choice then it creates a select element on run time by using
    Code:
    document.createElement()
    and set all the attributes along with an onchange funtion but the problem is that the internet explorer detects that there are new elements but the firefox does not here is the code
    Code:
    function makeAnswere(choice,rowId){
    	if(choice=="MC"){
    		clrAns(rowId);
    		var Inp=document.createElement("select");
    		Inp.setAttribute("id","TotalChoices");
    		Inp.setAttribute("name","TotalChoices");
    		Inp.setAttribute("onchange","getAnsweresChoices(this.value,"+rowId+")");
    		Inp.length=5;
    		divEle=document.getElementById("choices_div_"+rowId);
    		divEle.innerHTML="<table cellspacing='0' cellpadding='0' border='0' align='center' width='600'>"+
    							"<tr><td align='left' valign='middle' width='300'>Select total Answeres</td></tr>"+
    							"<tr><td align='left' valign='middle' id='choicer_"+rowId+"'></td></tr>"+
    							"</table>";
    		divChoice=document.getElementById("choicer_"+rowId);
    		divChoice.appendChild(Inp);
    		Inp.options[0].value="none";
    		Inp.options[1].value=2;
    		Inp.options[2].value=3;
    		Inp.options[3].value=4;
    		Inp.options[4].value=5;
    		Inp.options[0].text="Please Select Any";
    		Inp.options[1].text=2;
    		Inp.options[2].text=3;
    		Inp.options[3].text=4;
    		Inp.options[4].text=5;
    	}
    	if(choice=="TF"){
    		
    		trueFalsePopulate(rowId);
    	}
    	if(choice=="YN"){
    		clrAns(rowId);
    		YesNoPopu(rowId);
    	}
    	if(choice=="none"){
    		clrAns(rowId);
    		clrChoice(rowId);
    	}
    }
    function trueFalsePopulate(rowId){
    	xmlPopTf=GetXmlHttpObject();
    	if(xmlPopTf==null){
    		alert("Please Upgrade Your Browser");
    		return;
    	}else{
    		var url="ajax/populate-inputs.php";
    		var str_tf="r_tf="+Math.random()+"&rowId="+rowId;
    		xmlPopTf.onreadystatechange=$popuTrue;
    		xmlPopTf.open("POST",url,true);
    		xmlPopTf.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
    		xmlPopTf.send(str_tf);
    	}
    }
    function $popuTrue(){if(xmlPopTf.readyState==4){if(xmlPopTf.status==200){var a=xmlPopTf.responseText.split("|");clrChoice(a[1]);document.getElementById('answeres_div_'+a[1]).innerHTML=a[0];}}}
    function YesNoPopu(rowId){
    	xmlPopYn=GetXmlHttpObject();
    	if(xmlPopYn==null){
    		alert("Please Upgrade Your Browser");
    		return;
    	}else{
    		var url="ajax/populate-inputs.php";
    		var str_yn="r_yn="+Math.random()+"&rowId="+rowId;
    		xmlPopYn.onreadystatechange=$popuYn;
    		xmlPopYn.open("POST",url,true);
    		xmlPopYn.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
    		xmlPopYn.send(str_yn);
    	}
    }
    function $popuYn(){
    	if(xmlPopYn.readyState==4){
    		if(xmlPopYn.status==200){
    			var a=xmlPopYn.responseText.split("|");
    			clrChoice(a[1]);
    			document.getElementById('answeres_div_'+a[1]).innerHTML=a[0];
    		}
    	}
    }
  • omerbutt
    Contributor
    • Nov 2006
    • 638

    #2
    i figured it out i had the form inside the table that was the biggest mistake

    Comment

    Working...