Is there a way to test the type of an element in JavaScript?
The answer may or may not require the prototype library, however the following setup does make use of the library.
function(event) {
var element = event.element();
// if element is and anchor
...
// if element is a td
...
}