topical media & game development

talk show tell print

mashup-flickr-06-Exercise-2-lib-js-gallery.js / js



  var originalContent;
  
  function displayInfo(id)
  {
    var s = 'id=' + id;
    
    new Ajax.Request('info.php', 
    {
      parameters: s, 
      method: "post",
      onSuccess:function(response) 
      {
        var node = $('photo-info-' + id);
        originalContent = node.innerHTML;
        node.innerHTML = response.responseText;
      }, 
      onFailure:function(response) 
      {
        alert('Error: ' + response.status + ' ' + response.statusText);
      }
    });
  }
  
  function hideInfo(id)
  {
    // Restore original content
    var node = $('photo-info-' + id);    
    // remove all children
    while (node.firstChild != null)
    {
      node.removeChild(node.firstChild);
    }
    node.innerHTML = originalContent;
  }
  


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