this case, a Button form object is added as a way for the user to initiate the interaction between themselves and the page. Second, the onClick event is added as an attribute to the object. Although dozens of events exist for various types of objects, the onClick event exists as a way of alerting the browser that when the button is clicked, the showMessage() function should be called, and the code contained within the function should be executed. Finally, the function showMessage() is added in the code declaration block. This is where JavaScript gets complex because it represents the functionality we want performed when the user clicks the button. In our case, we want to show a pop-up message with the text Hello. To do this, we access the built-in alert() method of the window object and pass in the literal text "Hello" as a parameter to the alert() method. When all is said and done, the user clicks the button on the page to receive a message similar to Figure 10.1. Figure 10.1. Clicking the button raises the onClick event which in turn calls the showMessage() function. After the function is called, the code is executed, and a message appears. Although this code represents an example of JavaScript in practice, it's important to remember that the example is simple. The more functionality you'll need, the more complex the JavaScript becomes. For those who don't consider themselves JavaScript wizards, behaviors, contained within the Behaviors panel, are the perfect alternative to writing JavaScript by hand. So what was the relevance of the JavaScript example if we'll be using behaviors and the Behaviors panel from here on out? The answer to this question lies in the process we outlined. Within the code declaration block lies the functionality we need, otherwise known as an action. To get that action to execute, we need two things: an object (represented by a Button form object) and an event (represented by the onClick event set as an attribute for the Button object). The beauty of behaviors is that they contain prebuilt actions bundled with a set of events. All you need to do is supply the object in the form of an HTML element such as a hyperlink, an image, a form object, or even the page as a whole. After you've selected an object to use, you simply attach the action using the Behaviors panel, pick a supported event, and you're done! As you can see, behaviors, which are essentially prebuilt sets of actions bundled with various events, are attached to objects by way of the Behaviors panel. To see this process in action, let's turn our attention to the Behaviors panel. Using the Behaviors Panel The Behaviors panel, available by selecting the Behaviors option from the Window menu, is the catalyst for attaching behaviors to objects on your page. Although we'll certainly cover the myriad of available behaviors throughout the chapter, for now let's walk through the process of attaching a simple behavior, similar