Jump to content
  • Advertisement
Sign in to follow this  
Lucidquiet

[web] addEvent / attachEvent

This topic is 4076 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello: Will attaching an event through the methods that are part of IE and Firefox (because they are different) still fire even if I were to later do something like this: window.onload = myFunction; myImage.onload = myImageLoadFunction; ? L-

Share this post


Link to post
Share on other sites
Advertisement
I did some testing and it worked in IE7 and FF.


var test = function() {
alert(1);
};

var test2 = function() {
alert(2);
};

window.load = test();

window.load = test2();



So yes, it will perform both calls.

Share this post


Link to post
Share on other sites
Yup:

Alright, yeah, I wrote pretty much the same thing, along with using the addEventListener stuff from YUI. They all don't overwrite.

So how do you remove a listener?

L-

Share this post


Link to post
Share on other sites
Not sure since I don't use the YUI. I do all of my JS with jQuery, but even then, to unload a single action, I don't think this is possible since you're stacking different commands/functions to be executed. If you were to apply specific event listeners, then simply unbind that event so that nothing happens.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!