In general, think of JS as embedding in the HTML working on the client side, and CGI working on the server side handling HTML forms output. You and your browser are a client . For example, you can write a JavaScript function to verify that users enter valid information into a form reque sting a telephone number or zip code. Without any network transmission, the HTML page with embedded JavaScript can check the entered data and alert the user with a dialog box if the input is invalid. JavaScript applications in the Navigator are largely event-driven.
Events are actions that occur usually as a result of something the user does.
For example, clicking a button is an event, as is changing a text field or moving the mouse over a link. For your script to react to an event, you define event handlers , such as onChange and onClick . When you load a document in Navigator, it creates a number of JavaScript objects with property values based on the HTML in the document and other pertinent information. These objects exist in a hierarchy that reflects the structure of the HTML page itself. Depending on its content, the document may contain other objects.