We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Posted By

iTony on 02/09/08


Tagged

javascript tags hover


Versions (?)


Suckerfish hover


Published in: JavaScript 


URL: http://www.htmldog.com/articles/suckerfish/dropdowns/

This would make IE treat the hover element in whichever tag you implemented.

  1. sfHover = function() {
  2. var sfEls = document.getElementById("nav").getElementsByTagName("LI");
  3. for (var i=0; i<sfEls.length; i++) {
  4. sfEls[i].onmouseover=function() {
  5. this.className+=" sfhover";
  6. }
  7. sfEls[i].onmouseout=function() {
  8. this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
  9. }
  10. }
  11. }
  12. if (window.attachEvent) window.attachEvent("onload", sfHover);

Report this snippet 

You need to login to post a comment.