[Javascript] Microsoft.XMLDOM onreadystatechange

Håkan Magnusson hakan at backbase.com
Tue Oct 21 10:58:32 CDT 2003


This is my first posting to this list, so please have patience if I'm 
posting in the wrong direction.

Consider the following code:


function load_xml(sURL) {
   oMyTmpObj = new ActiveXObject('Microsoft.XMLDOM');
   oMyTmpObj.onreadystatechange = check_me;
   oMyTmpObj.load(sURL);
}

function check_me() {
   alert(this.readyState);
}


In the "check_me"-function, "this" is undefined. As we are loading 
multiple files in an asynchronous manner, we _need_ to keep track on 
wich XMLDOM-object that fires the onreadystatechange-event. We can't 
declare each and every XMLDOM-object in the document scope, as this 
would get out of hand fast.

All examples I've found so far expects you to declare the 
XMLDOM-variable within the document scope, and then address this 
directly within the "check_me" equivalent function of that example.

Any suggestions?

Thankyou in advance,
Håkan




More information about the Javascript mailing list