HomeJavaScript Understanding The JavaScript Event Model (part 1)
Understanding The JavaScript Event Model (part 1)
This may be news to you, but JavaScript comes with a powerfuland flexible event model, one which provides developers with astandardized way of trapping and handling client-side events likekeystrokes and mouse clicks. This two-part article takes an in-depthlook at how this event model works, demonstrating some practical (andnot-so-practical) uses of the most common event handlers.
If you're new to Web development, it's quite likely that you started off with JavaScript, the simple client-side scripting language that's supported in almost every Web browser. Maybe you've learnt a little bit of the language, and have understood how useful it is for basic browser detection and form validation tasks. And maybe you're wondering if there's more to the language, or if this is all she wrote...
Well, you're right to wonder, and right in thinking there's more. JavaScript comes with a fairly well-thought-out event model, one which can be exploited by a clever developer to perform fairly complicated tasks on the client side. This event model is one of the most fundamental things about the language - and, over the next few pages, I'm going to show you the basics of how it works. Keep reading.