1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| function loadXML(url)
{
/* chargement du fichier XML */
try {
// navigateur basé sur Gecko
if (document.implementation && document.implementation.createDocument)
{
this.xmlDoc = document.implementation.createDocument('', 'doc', null);
this.xmlDoc.load(url);
// à l'aide de lobjet XMLHTTPRequest
} else if (window.XMLHttpRequest) {
this.xmlDoc = new XMLHttpRequest();
this.xmlDoc.overrideMimeType('text/xml');
this.xmlDoc.onreadystatechange = function() { if (this.xmlDoc.readyState == 4) this.loaded = true; }
this.xmlDoc.open('GET', url, true);
this.xmlDoc.send(null);
// ActiveX pour Internet Explorer
} else if (window.ActiveXObject) {
try {
this.xmlDoc = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
this.xmlDoc = new ActiveXObject("Microsoft.XMLHTTP");
}
this.xmlDoc.onreadystatechange = function() { if (this.xmlDoc.readyState == 4) this.loaded = true; }
this.xmlDoc.open('GET', url, true);
this.xmlDoc.send(null);
}
} catch (e) {
alert(e);
return false;
}
return true;
} |