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

designerd on 10/06/06


Tagged

javascript js ie liover


Versions (?)


Who likes this?

2 people have marked this snippet as a favorite

jonhenshaw
rnrleachryan


li:hover in IE


Published in: JavaScript 


Lets IE set a class .over on hover as IE doesn't support li:hover


  1. startList = function() {
  2. if (document.all && document.getElementById) {
  3. navRoot = document.getElementById("dmenu");
  4. for (i=0; i < navRoot.childNodes.length; i++) {
  5. node = navRoot.childNodes[i];
  6. if (node.nodeName=="LI") {
  7. node.onmouseover=function() {
  8. this.className+=" over";
  9. }
  10. node.onmouseout=function() {
  11. this.className=this.className.replace(" over", "");
  12. }
  13. }
  14. }
  15. }
  16. }
  17.  
  18. window.onload=startList;

Report this snippet 

You need to login to post a comment.