Once you finish defining your menu, you need to define event handlers to respond to the user's selection.
Adding an event handler for a menu choice is as easy as adding an ONCLICK handler to a specific menu choice's table cell:
You can also take advantage of event bubbling and write generic event handlers. The color selector was written with a single
onclick event handler, rather than an event handler for each color. This was accomplished by putting the event handler on the
TABLE containing the color menu:
In some cases, you may want to trap all your menu options in a single function. The Menu Library provides
a function you can customize for handling all menu selections. This function is currently defined in the library
and should not be defined in duplicate in your page's script.
In general, since your menus are specially formatted tables, all the event's and techniques available for tables are also available for your menus. To help bring this all together, the next page demonstrates embedding the style sheet and code library on your web page.
© 1997-2000 InsideDHTML.com, LLC. All rights reserved.