Isolate the problematic code and reproduce it in an online environment such as jsFiddle or JS Bin.
If a library or framework is used, then tag the question with the appropriate tags: jquery for jQuery,prototypejs for Prototype, mootools for MooTools, and so on. However, if a framework is not used or necessary, do not include these tags.
Mention which browser the code is having problems on, and what error messages, if any, were thrown by the browser. If the question is browser-specific, use tags firefox, google-chrome, internet-explorer, opera, etc.
quirksmode.org | Introduction to Events: A comprehensive description of the various types of event handling. Includes overview of different ways to attach event handlers and points out quirks between different browsers. A must-read if you want to understand event handling.