Difference between revisions of "Template:Washington"

Line 427: Line 427:
  
 
     function init() {
 
     function init() {
 +
 +
      // Grab the tab links and content divs from the page
 +
      var tabListItems = document.getElementById('tabs').childNodes;
 +
      for ( var i = 0; i < tabListItems.length; i++ ) {
 +
        if ( tabListItems[i].nodeName == "LI" ) {
 +
          var tabLink = getFirstChildWithTagName( tabListItems[i], 'A' );
 +
          var id = getHash( tabLink.getAttribute('href') );
 +
          tabLinks[id] = tabLink;
 +
          contentDivs[id] = document.getElementById( id );
 +
        }
 +
      }
 +
 +
      // Assign onclick events to the tab links, and
 +
      // highlight the first tab
 +
      var i = 0;
 +
 +
      for ( var id in tabLinks ) {
 +
        tabLinks[id].onclick = showTab;
 +
        tabLinks[id].onfocus = function() { this.blur() };
 +
        if ( i == 0 ) tabLinks[id].className = 'selected';
 +
        i++;
 +
      }
 +
 +
      // Hide all content divs except the first
 +
      var i = 0;
 +
 +
      for ( var id in contentDivs ) {
 +
        if ( i != 0 ) contentDivs[id].className = 'tabContent hide';
 +
        i++;
 +
      }
 +
    }
 +
 +
function init1() {
  
 
       // Grab the tab links and content divs from the page
 
       // Grab the tab links and content divs from the page

Revision as of 02:54, 18 September 2015