topical media & game development

talk show tell print

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



  // A function for hiding (using display) an element
  function hide( elem ) {
      // Find out what it’s current display state is
      var curDisplay = getStyle( elem, ‘display’ );
  
      //  Remember its display state for later
      if ( curDisplay != ‘none’ )
          elem.oldDisplay = curDisplay;
  
      // Set the display to none (hiding the element)
      elem.style.display = ‘none’;
  }
  
  // A function for showing (using display) an element
  function show( elem ) {
      // Set the display property back to what it use to be, or use
      // ‘block’, if no previous display had been saved
      elem.style.display = elem.oldDisplay || ‘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.