topical media & game development

talk show tell print

#javascript-code-07-relatedTarget.js / js



  // Find all the <li> elements in the document
  var li = document.getElementsByTagName(“li”);
  for ( var i = 0; i < li.length; i++ ) {
  
      // and attach mouseover handlers to them
      li[i].onmouseover = function(e){
  
          // If the mouse is entering for the first time (from the parent)
          if ( e.relatedTarget == this.parentNode ) {
              // display the last child element (which happens to be another <ol>)
              this.lastChild.style.display = ‘block’;
          }
  
      };
  
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.