------------PART ONE------------------

if(navigator.appName == "Netscape"){
        xmlHttp = new XMLHttpRequest();
        xmlHttp.open("GET",xmlfile , false);
        xmlHttp.send(null);
        docObj = xmlHttp.responseXML;
        var objNodesname = docObj.getElementsByTagName("name");
    }else{
        var docObj = new ActiveXObject("MSXML.DOMDocument");
        docObj.load(xmlfile);
        var objNodesname = docObj.getElementsByTagName("name");
    }

------------PART TWO------------------

for (i = 0 ; i < objNodesnames.length ; i++) {
            if(navigator.appName == "Netscape"){
              objcurrent=objNodesnames.item(i);
              myceltext=objcurrent.childNodes.item(0);
              currenttext=document.createTextNode(myceltext.data);
              lstring=currenttext.data;
              lstring=lstring.substr(4)
              lstringcode=lstring.substr(0,4)

            }else{
              lstring=objNodesnames.item(i).text;
              lstringcode=lstring.substr(0,4);
              lstring=lstring.substr(4);
            }

Try something like this to replace the first code:

function getXHR()
{
	/*	Used to retrieve and XML HTTP Request object
		Output: an XMLHttpRequest object
	*/
	
	var XHR;
	
	// First determine user's browser
	if (window.XMLHttpRequest)	// Non-IE browser such as FireFox or Netscape
	{
		return new XMLHttpRequest();
	}
	else if (window.ActiveXObject)	// IE
	{
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		// Assume browser doesn't support AJAX technologies
	}
}

The second bit of code should work fine applying the same logic: don't check for the actual browser (especially Netscape) but check if the element your trying to use exists in the browser.

Thanks! I'll try it out.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.