First lets assume you have table on an HTML page something like this:
Obviously this is a small table, but works fine for this example. Instead of attaching an onclick=”eventname” to each “td” element, we can simply add a single event to the whole number to manage it. Check out this script:
So you’ll notice the first step is to attach a click event handler to the entire table. Then whenever the table is clicked, we do a check to ensure it was a “TD” element thats has been clicked (or whatever element you may want). Then you can extrapolate your source element exactly the same as if the event was called on that element. In this example I just output the contents of the cell, but lets you see how you can implement this so easily, and how this method would save a ton on performance and scalability is not an issue!!!
Much much cleaner as well, rather than attaching events to each TD or writing the events on the markup page!