Hi
i'd like to call a method from an object by an event. but how can i
access the object?
xhtml:
....
<div id="layer">Som e Content</div>
....
javascript:
....
var Dragger = function() {
this.message = "Hello World";
this.element = document.getEle mentById('layer ');
this.init();
}
Dragger.prototy pe.init() {
this.element.on mousemove = this.drag;
}
Dragger.prototy pe.drag(event) {
alert(this.mess age);
}
var oDragger = new Dragger();
....
How can I access the Message-Variable within the Drag-Method?
=> 'this' is no longer the object, its now en eventobject...
Can anyone help?
Thanks //jim
i'd like to call a method from an object by an event. but how can i
access the object?
xhtml:
....
<div id="layer">Som e Content</div>
....
javascript:
....
var Dragger = function() {
this.message = "Hello World";
this.element = document.getEle mentById('layer ');
this.init();
}
Dragger.prototy pe.init() {
this.element.on mousemove = this.drag;
}
Dragger.prototy pe.drag(event) {
alert(this.mess age);
}
var oDragger = new Dragger();
....
How can I access the Message-Variable within the Drag-Method?
=> 'this' is no longer the object, its now en eventobject...
Can anyone help?
Thanks //jim
Comment