topical media & game development

talk show tell print

#javascript-code-15-anon.js / js



  // Create a new anonymous function, to use as a wrapper
  (function(){
      // The variable that would, normally, be global
      var msg = "Thanks for visiting!";
  
      // Binding a new function to a global object
      window.onunload = function(){
          // Which uses the 'hidden' variable
          alert( msg );
      };
  
  // Close off the anonymous function and execute it
  }());
  
  


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