By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,257 Members | 1,569 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,257 IT Pros & Developers. It's quick & easy.

Creating a XML document inside a class

P: n/a
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,

Jun 23 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a


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;
};
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jun 24 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.