Emery ringtonesByron Cage ringtonesCat Stevens ringtonesAni DiFranco ringtones

Multiple Event Attachments...

One comment is that you're adding a memory overhead for each event listener you're attaching. For a half-dozen rollovers, this isn't a problem, but you could potentially be attaching several dozen of them.

In such a case, you'd want to attach one event listener on a parent element and check for individual cases by determining the target of the button click. So, for instance, something like the following:

var over = function(eventObject) {
    // get around IE's quirky DOM handling
    var target = (eventObject.target) ? eventObject.target : eventObject.srcElement
 
    if (YAHOO.util.Dom.hasClass(target, 'btn')) { 
        // it means we have a menu button
        YAHOO.util.Dom.addClass(target, 'btn-over');
    }
}
YAHOO.util.Event.on('menu', 'mouseover', over);

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <codeblock> <blockquote> <h1> <h2> <h3> <h4> <h5> <img>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.
  • Use the special tag [adsense:format:group:channel] or [adsense:flexiblock:location] to display Google AdSense ads.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.