Topic awaiting preservation: Issues with assigning events inside objects... (Page 1 of 1) |
|
---|---|
Maniac (V) Inmate From: Brisbane, Australia |
posted 01-19-2003 03:03
Ok, this is going to be a lot easier with an example: |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 01-19-2003 03:40
I encountered this recently while working on my ultra secret project. I was creating buttons and assigning their onclick events. I eventually used this strategy: |
Maniac (V) Inmate From: Brisbane, Australia |
posted 01-19-2003 04:00
"remember: objects are copied by reference, not value" |
Bipolar (III) Inmate From: schillmania.com |
posted 01-19-2003 09:58
Now it might be the time of day here (it's late ) - but couldn't you assign an event handler for an object that references a method within that object? |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 01-19-2003 16:51
Nice idea, but unfortunately, once you assign it to document.onmouseup, when it's called because the document was mouseuped, it runs as a method of the document object, rather than what it was originally defined as. |
Bipolar (III) Inmate From: schillmania.com |
posted 01-20-2003 03:03
Ah-ha that makes sense .. I was looking over some stuff I'd written later on, and realized I hadn't followed that form for assigning event handers. Everything was = function() {something.blah(this)} or whatever. |