Unload event : unload « jQuery « JavaScript Tutorial






<html>
  <head>
    <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
        
            $(window).unload( function () { alert("Bye now!"); } );



        });
    </script>
  </head>
  <body>
    <body>
    <form action="javascript:alert('success!');">
        <div>
          <input type="text" />
          <input type="submit" />
        </div>
     </form>

     <div></div>


    </body>
</html>








30.113.unload
30.113.1.Unload event
30.113.2.To display an alert when a page is unloaded: