PDA

View Full Version : [JAVASCRIPT/XML] problema con ff


vladix
26-03-2008, 23:47
salve , ho fatto una funzione js che restituisce un "oggetto" xml e che dovrebbe andare bene sia con ie che con ff , con ie va bene , e andrebbe bene anche con ff , se usasi il metodo onload , solo che vorrei che questa funzione fosse generica ( quindi nn voglio chiamare altri metodi , ma voglio l'oggetto xml , penso che se riuscissi a sincronnizare il metodo .... in modo che fa "return" solo dopo aver letto il documento :lamer: :cry:

function Xml(file){

var xmlDoc;

this.getDocument = function(){
if(window.ActiveXObject){
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.onreadystatechange=this.verificaStato;
xmlDoc.load(file);
return xmlDoc.documentElement;
}else{
xmlDoc = document.implementation.createDocument("", "", null);
//xmlDoc.onload = .....
xmlDoc.load(file);
return xmlDoc;

}
}

this.verificaStato = function (){
if (xmlDoc.readyState != 4){
return false;
}
}
}