Q:

onclick handler on  tags, find out which tag was clicked

I have 5 anchor tags on my page.  Now when one of these tags gets clicked I want to call a JavaScript function, in this function I need to find out which of the anchors was clicked. 
How can this be handled? 
I want to do it in pure JavaScript or with dojo. 

A:

var anchors = document.getElementsByTagName("a");

for(var i = 0; i < anchors.length; i++) {
    anchors[i].onclick = function() {
        alert(this.id);
        doStuff(id);
        return false;   
    }
}

Demo: http://jsfiddle.net/FVWqT/1/
Note, if you have more than five anchors, and want to target only specific ones, you might want to filter by class, for example:
var anchors = document.getElementsByTagName("a");

for(var i = 0; i < anchors.length; i++) {
    if(anchors[i].className == "something") {
        anchors[i].onclick = function() {
            alert(this.id);
            doStuff(id);
            return false;   
        }
    }
}

