topical media & game development

talk show tell print

#javascript-code-11-nextsibling.js / js



  // Find all DT (Defintion Term) elements
  var dt = document.getElementById(“dt”);
  for ( var i = 0; i < dt.length; i++ ) {
      // Watch for when the term is clicked
      dt[i].onclick = function() {
          // Since each Term has an adjacent DD (Definition) element
          // We can display it when it’s clicked
          this.nextSibling.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.