jmaddy10 0 Newbie Poster

Hello all!

I am making a site for a club on campus and we need to show the presidents quotes on the site. He has some lengthy ones so I want to save space (can't tell him to KISS) so I'm using a little code I learned to do so.

This code retrieves text (or xml but im sticking to text) elements and allows me to display them in the area. when someone is done reading that quote they can click on another question (link) and the answer text will appear there.

here is the HTML:

<div id="presQs">
			<p>
			
			<a id="makeTextRequest" href="1join.txt">Why did you first join Amnesty?</a>
			<a id="makeTextRequest" href=""></a>
			<a id="makeTextRequest" href=""></a>
			<a id="makeTextRequest" href=""></a>
			
			

			</p>
			<div id="updateArea">
			
			&nbsp;
					
			</div>

and here is the javascript

window.onload = initAll;
var xhr = false;

function initAll() {
	document.getElementById("makeTextRequest").onclick = getNewFile;
	document.getElementById("makeXMLRequest").onclick = getNewFile;
	
}
	
function getNewFile() {
	makeRequest(this.href);
	return False;
	
}

function makeRequest(url) {
	if (window.XMLHttpRequest) {
	xhr = new XMLHttpRequest();
	
	}
	
	else {
		if (window.ActiveXObject)  {
		  try {
				xhr =new ActiveXObject
					("Microsoft.XMLHTTP");
					
				}
				catch (e) { }
				}
		}
		
		if (xhr){
				xhr.onreadystagechange = showContents;
				xhr.open("GET", url, true);
				xhr.send(null);
			}
			else {
				document.getElementById("updateArea").innerHTML = "Sorry, but this feature is currently disabled.  This may be because you're browser is either unidentifiable or out-dated.";
	}
}

	function showContents() {
		if (xhr.readyState == 4)	{
			if (xhr.status == 200) {
				if (xhr.responseXML && xhr.responseXML.contentType== "text/xml") {
				
				var outMsg = xhr.responseXML.getElementsByTagName("choices")[0].textContent;
				
				}
				
				else {
					var outMsg = xhr.responseText;
					}
				}
				
				else {
					var outMsg = "There was a problem with the request " + xhr.status;
				
				}
				
				document.getElementById("updateArea").innerHTML = outMsg;
				}
			}

The code isn't posting with the "updateArea" div but is actually going to a seperate page. How can I fix this?

Thanks in advance!!!