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 34 35 36 37 38 39 40 41 42 43 44
| // Renvoie le texte de l'objet ActiveXObject le plus récent depuis une liste
var pickRecentProgID = function (idList){
// found progID flag
var bFound = false;
for(var i=0; i < idList.length && !bFound; i++){
try{
var oDoc = new ActiveXObject(idList[i]);
o2Store = idList[i];
bFound = true;
}catch (objException){
// trap; try next progID
};
};
if (!bFound)
throw ("Aucun ActiveXObject n'est valide sur votre ordinateur, pensez à mettre à jour votre navigateur");
idList = null;
return o2Store;
}
// Retourne un nouvel objet XmlHttpRequest
var GetXmlHttpRequest_AXO=null
var GetXmlHttpRequest=function () {
if (window.XMLHttpRequest) {
return new XMLHttpRequest()
}
else if (window.ActiveXObject) {
if (!GetXmlHttpRequest_AXO) {
GetXmlHttpRequest_AXO=pickRecentProgID(["Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"]);
}
return new ActiveXObject(GetXmlHttpRequest_AXO)
}
return false;
}
// Chargement du fichier
var xhr=GetXmlHttpRequest()
xhr.open("GET", fichierXML, true)
xhr.onreadystatechange=function() {
if (xhr.readyState==4) {
xmlDoc = xhr.responseXML;
afficheMenu(xmlDoc)
}
}
xhr.send(null) |