530 Part III . Document Objects Reference Passing (Make my own web site)

530 Part III . Document Objects Reference Passing forms and elements to functions When a form or form element contains an event handler that calls a function defined elsewhere in the document, you can use a couple of shortcuts to simplify the task of addressing the objects while the function does its work. Failure to grasp this concept not only causes you to write more code than you have to, but it also hopelessly loses you when you try to trace somebody else s code in his or her JavaScripted document. The watchword in event handler parameters is this which represents a reference to the current object that contains the event handler attribute. For example, consider the function and form definition in Listing 23-1. The entire user interface for this listing consists of form elements, as shown in Figure 23-1. Listing 23-1: Passing the Form Object as a Parameter Beatle Picker

Choose your favorite Beatle: John Paul George Ringo

Enter the name of your favorite Beatles song:

FORM
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.

Leave a Reply