Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Event Capturing Nightmares

Status
Not open for further replies.

fugigoose

Programmer
Jun 20, 2001
241
US
I'm attempting to build a library of custom elements that are deveride from various standard elements. For example, I created a rollOverImage element from an img element. It all works great until it gets to event handling. There doesn't seem to be an easy way to assign an event to a method with javascript. I can route an event to a function with addEventListener(), but then I loose the 'this' object. With IE i solved this problem by making global functions for my events and tying global window events to them. The functions themselves called the handler of the event.srcElement. This however is not possible in Firefox or other browsers because there is no event object. So basically what I want to do is tie an event to a method within my custom class. I also need to be able to use the 'this' keyword within the method. If any one can come up with a clever solution that would be awesome!
 
>>because there is no event object.

there is an event object for firefox and mozilla, its just not built in,
when u call the function try this:
.. onclick="TheFunction(event)">

function TheFunction(TheEventObject)

this will capture the event object in TheEventObject...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top