I'm having some Javascript woes, lets say we have a constructor
function test(element) {
this.element = element;
this.element.onfocus = function() { this.onfocus(); }
}
test.prototype.onfocus = function() {
alert("focused");
}
new test(document.getElementByID("E1"));
So I am trying to dynamically set the focus event inside the constructor, but it doesn't seem to work, and I can't figure it out.
Anyone help?
Thanks,
AJ