1. Unobtrusive JavaScript

  2. Lessons learned from CSS

  3. CSS: inline vs. external

  4. JavaScript: inline vs. external

  5. Writing the function

  6. Object detection

    
    function doPopups() {
      if (document.getElementsByTagName) {
        var links = document.getElementsByTagName("a");
        for (var i=0; i < links.length; i++) {
          if (links[i].className.match("help")) {
            links[i].onclick = function() {
              window.open(this.getAttribute("href"));
              return false;
            };
          }
        }
      }
    }
    
  7. Personal preference

    
    function doPopups() {
      if (!document.getElementsByTagName) return false;
      var links = document.getElementsByTagName("a");
      for (var i=0; i < links.length; i++) {
        if (links[i].className.match("help")) {
          links[i].onclick = function() {
            window.open(this.getAttribute("href"));
            return false;
          };
        }
      }
    }
    
  8. Triggering the function

  9. Next

    Applying Progressive Enhancement to Ajax: Hijax