Tuesday, September 1, 2009

Javascript XML Parsing Problem Solution in Internet Explorer

function loadXMLDoc(dname)

{

var xmlDoc;

if (navigator.userAgent.indexOf('MSIE')>=0)

// Internet Explorer

{

xmlDoc=new ActiveXObject("Microsoft.XMLDOM");

xmlDoc.async=false;

xmlDoc.load(dname);

return xmlDoc;

}

else

{

xmlDoc=new window.XMLHttpRequest();

xmlDoc.open("GET",dname,false);

xmlDoc.send("");

return xmlDoc.responseXML;

}

alert("Error loading document");

return null;

}

No comments:

Post a Comment