Creating a XML document inside a class

L

Leo

Hello,

Im trying to set up a XML document object within a class declaration
(mozilla only):

MyClass.prototype.loadXML = function(file)
{
this.isLoaded = false;
this.xml = document.implementation.createDocument("","",null);
this.xml.onload = this.fileLoaded;
this.xml.load(file);
}

MyClass.prototype.fileLoaded()
{
this.isLoaded = true;
}

Somehow, the isLoaded property doesnt seem to be set to true when i
create an instance of the class. I tryied passing the object instance
through an argument

...
this.xml.onload = this.fileLoaded(this)
...
MyClass.prototype.fileLoaded(obj)
{
obj.isLoaded = true;
}

but i get even weirder results. Any ideas?

Thanks,
 
M

Martin Honnen

Leo wrote:

MyClass.prototype.fileLoaded()
{
this.isLoaded = true;
}

The above is a function call followed by a block with one assigment
statement. I think you rather want

MyClass.prototype.fileLoaded = function () {
this.isLoaded = true;
};
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top