topical media & game development

talk show tell print

#javascript-code-02-lightbox.js / js



  // Locate all anchor tags on the page
  var anchors = document.getElementsByTagName("a");
  
  // Loop through all anchor tags
  for ( var i=0; i < anchors.length; i++ ) {
      var anchor = anchors[i];
  
      // Make sure that the link is a "lightbox" link
      if ( anchor.href && anchor.rel == "lightbox" ) {
  
          // Make it so that a Lightbox is shown on click
          anchor.onclick = function () {
              showLightbox(this);
              return false;
         };
  
      }
  }
  
  


(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.