Hello all from Sweden.
I’m working on a system in OOP Javascript. I have some big problems
with this prototype thing…
It’s really confusing. BTW, this is a Firefox only problem, none of the other browser are important for this system. Anyway this is what i got right now:
function sysInit() {
this.objDOMWindow = window;
// I believe this one is missplaced…
// If i remove it, the code run flawlessly without inheritance from mwas.
xreq.prototype = this;
}
window.onload = function () {
var mwas = new sysInit;
var mwasreq = new xreq();
// This is were my problem arise.
// In firefox the error says: mwasreq.send is not a function.
mwasreq.send();
}
function xreq(){
if(window.XMLHttpRequest) {
try {
this.req = new XMLHttpRequest();
} catch(e) {
return false;
}
}
}
xreq.prototype.send = function (){
// Works without xreq.prototype = this; in sysInit…
alert(this.req);
// Does not work! In any way…
alert(this.objDOMWindow);
}
Hope some OOP Javascript guru can help me out.
?
Best regards
Adrian