[Javascript] Microsoft.XMLDOM onreadystatechange

Håkan Magnusson hakan at backbase.com
Tue Oct 21 12:17:37 CDT 2003


Hi Chris!

Sorry, this generates the exact same error as

 > oMyTmpObj = new ActiveXObject('Microsoft.XMLDOM');
 > oMyTmpObj.bIsLoaded = false;

but during the object creation in XMLObj.

(Can't assign property to 'this' on row bla bla "this.bIsLoaded = false;")

It seems that since "this" becomes the actual ActiveXObject component, 
the same restrictions apply as when I do it directly. This is sortof 
just wrapping the "bug". Not bug, I know, but you get the point.

Thanks anyway. :)

Håkan

Chris Tifer wrote:
> I wouldn't add the properties to that Component you're using. If anything,
> the properties are on the object you're calling. If you fire the
> onreadystatechange event and detemine it's finished loading, you can update
> your property on that object. For instance (pseudo code):
> 
> function XMLObj(){
>     this = new ActiveXObject('Microsoft.XMLDOM');
>     this.bIsLoaded = false;
>     this.onreadystatechange = check_me
> }
> 
> 
> function check_me(){
>     if(this.readystate == "what youre looking for"){
>         this.blIsLoaded = true
>         // will only pertain to this 'instance' of the object
>         // and will set it's blIsLoaded property to true
>         // in my example then, you could check its value by
>         // checking: objXMLComp.blIsLoaded
>     }
> }
> 
> var objXMLComp = new XMLObj()
> 
> Now you'll have a reference to your object by referencing objXMLComp and
> whenever you check any properties/perform any methods on it, the functions
> can refer to this.
> 
> The only part I'm confused about because I hadn't had to use, is how you'd
> set this to the new ActiveXObject('component')
> 
> I am assuming something like what I have above would work, but would
> probably take some tweakig.
> 
> 
> ----- Original Message ----- 
> From: "Håkan Magnusson" <hakan at backbase.com>
> To: "[JavaScript List]" <javascript at LaTech.edu>
> Sent: Tuesday, October 21, 2003 12:21 PM
> Subject: Re: [Javascript] Microsoft.XMLDOM onreadystatechange
> 
> 
> Hi Chris!
> 
> I think understand your solution, but we've tried that.
> You can't add properties to an XMLDOM-ActiveXObject.
> 
> oMyTmpObj = new ActiveXObject('Microsoft.XMLDOM');
> oMyTmpObj.bIsLoaded = false;
> 
> Doesn't work.
> 
> Or am I misunderstanding?
> 
> Håkan
> 
> 
> Chris Tifer wrote:
> 
> 
>>Perhaps you should create an object and then instantiate new instances of
>>these objects. Then make check_me a method on that object. That should
> 
> clear
> 
>>up your problem and you will be able to use this - as far as I can tell
> 
> from
> 
>>what you're trying to do.
>>
>>Chris Tifer
>>
>>
>>----- Original Message ----- 
>>From: "Cutter (JavaScript List)" <java.script at seacrets.com>
>>To: "[JavaScript List]" <javascript at LaTech.edu>
>>Sent: Tuesday, October 21, 2003 12:06 PM
>>Subject: Re: [Javascript] Microsoft.XMLDOM onreadystatechange
>>
>>
>>Håkan,
>>
>>The functions you are trying to write are JScript, not JavaScript.
>>JScript is a similar scripting language developed by Micro$oft for
>>working with IE, Windows, and various M$ web technologies. You can (or
>>could) find information on JScripting on the MSDN website.
>>
>>Cutter
>>
>>Håkan Magnusson wrote:
>>
>>
>>
>>>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
>>>
>>>_______________________________________________
>>>Javascript mailing list
>>>Javascript at LaTech.edu
>>>https://lists.LaTech.edu/mailman/listinfo/javascript
>>
>>
>>
>>
>>_______________________________________________
>>Javascript mailing list
>>Javascript at LaTech.edu
>>https://lists.LaTech.edu/mailman/listinfo/javascript
>>
>>_______________________________________________
>>Javascript mailing list
>>Javascript at LaTech.edu
>>https://lists.LaTech.edu/mailman/listinfo/javascript
>>
>>.
>>
> 
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> .
> 




More information about the Javascript mailing list