next up previous
Next: More Browser Information Up: First Steps in JavaScript Previous: A Simple Example 1

More Functions

We can add more functions that get called on different events:

The program also introduces some more objects and some useful applications of JavaScript:

The full code for this example is:

<html>
 <head>
   <script language="javascript">

   function popup(){
   var major = parseInt(navigator.appVersion);
   var minor = parseFloat(navigator.appVersion);
   var agent = navigator.userAgent.toLowerCase();

   document.write("<h1>Details in Popup</h1>");
   window.alert(agent + " " + major);
   }

   function farewell(){
   window.alert("Farewell and thanks for visiting");
   }
   </script>
 </head>

<body onLoad="popup()" onUnLoad="farewell()">
</body>
</html>



Dave Marshall
9/28/2001