AJAX:Failed Request

The following AJAX example doesnot return the requested file to the div, but opens in a new window, in Safari 2.0.4. Unable to find errors in Firefox debugging tool…

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
<head>
     <title>My First Ajax Script</title>
     <script src="script01.js" type="text/javascript" language="Javascript">
     </script>
</head>
<body>
     <p><a id="makeTextRequest" href="gAddress.txt">Request a text file</a><br />
     <a id="makeXMLRequest" href="us-states.xml">Request an XML file</a></p>
     <div id="updateArea">&nbsp;</div>
</body>
</html>


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.onreadystatechange = showContents;
        xhr.open("GET", url, true);
        xhr.send(null);
     }
     else {
        document.getElementById("updateArea").innerHTML = "Sorry, but I couldn't create
 an XMLHttpRequest";
     }
}

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


gAddress.txt
Four score and seven years ago our fathers
brought forth on this continent, a new nation,
conceived in Liberty, and dedicated to the....


<choices xml:lang="EN">
     <item><label>Alabama</label><value>AL</value></item>
     <item><label>Alaska</label><value>AK</value></item>
     <item><label>Arizona</label><value>AZ</value></item>
     <item><label>Arkansas</label><value>AR</value></item>
     <item><label>California</label><value>CA</value></item>
     <item><label>Colorado</label><value>CO</value></item>
     <item><label>Connecticut</label><value>CT</value></item>
     <item><label>Delaware</label><value>DE</value></item>
     <item><label>Florida</label><value>FL</value></item>
     <item><label>Georgia</label><value>GA</value></item>
     <item><label>Hawaii</label><value>HI</value></item>
     <item><label>Idaho</label><value>ID</value></item>
     <item><label>Illinois</label><value>IL</value></item>
     <item><label>Indiana</label><value>IN</value></item>
     <item><label>Iowa</label><value>IA</value></item>
     <item><label>Kansas</label><value>KS</value></item>
     <item><label>Kentucky</label><value>KY</value></item>
     <item><label>Louisiana</label><value>LA</value></item>
     <item><label>Maine</label><value>ME</value></item>
     <item><label>Maryland</label><value>MD</value></item>
     <item><label>Massachusetts</label><value>MA</value></item>
</choices>