Hi all,

Sorry Ive just realized I posted this in the wrong section....Im still new to this but learning fast.

I have a set of code that searches an xml sheet then displays the relevant Airfield searched for in a <span> below this it should display All the relevant airport plates (small maps) and be linked to their correct PDF.

The above works however I can only get it to display one plate in the span, ive tried a few different loops to try and get it to retrieve all the node information but am now chasing my tail can somone please have a look at the code below and let me know where im going wrong and suggest a solution?

Thanks
Mike




Code:
function searchXml(){
	
	getText=document.getElementById("searchText").value.toUpperCase();
	var countrys = xmlPdfDoc.getElementsByTagName('Country');
	
	
	//alert("Looking for "+getText);
	//the node numbers are different for Moz and IE
	if (window.ActiveXObject) {
		nodeNum=0;
	}
	else{
		nodeNum=1;
	}
	
	
	
	
	for(var i=0; i<countrys.length; i++){
		
		
		var airfields = countrys[i].getElementsByTagName("AirField");
		
		
		for(var airfieldNo=0; airfieldNo<airfields.length; airfieldNo++){
			
				
				
				optIcao=airfields[airfieldNo].getElementsByTagName("name")[0].childNodes[0].nodeValue;
				optIcao=optIcao.substring(0,4);
				
				optTexts=airfields[airfieldNo].getElementsByTagName("name")[0].childNodes[0].nodeValue;
				
				
				//This line brings in the a chart name.
				optRes=airfields[airfieldNo].getElementsByTagName("Plate")[j].childNodes[nodeNum].childNodes[0].nodeValue;
				
				//This line brings in the PDF Name relevant to the chart
				optResPlate=""+airfields[airfieldNo].getElementsByTagName("Plate")[j].childNodes[nodeNum+nodeNum+1].childNodes[0].nodeValue+".pdf";
				
				
				if(optTexts.search(getText)>=0){
					//alert("found match "+optTexts+", in country #"+i+"airfield #"+optValue);
					//fileName="+optText+";
					
					Results(optTexts+"" ) ;
					
				}
				
				
				
		}
		
	}



}

// Displays the Search results on screen.

function Results(strDisplay){
	var cartNum=parseInt(document.getElementById("cartNum").value);
	var cartLine="<span  id='cartWrapper"+cartNum+"' class='cartLine'  >";
	cartLine+="<a >"+strDisplay+"</a> ";
	cartLine+="";
	cartLine+="<input type='hidden'  value='enabled' id='cartValid"+cartNum+"'/><br><span><img src='images/pdf.PNG' >&nbsp;<a href='./taps/"+optResPlate+"' target='_blank'>"+optRes+"</a><br>&nbsp;<br></span>";
	cartLine+="<br></span>";
	
	//alert(cartLine);
	document.getElementById("cart").innerHTML+=cartLine;
	document.getElementById("cartNum").value=parseInt(cartNum+1);
}