Una cosa del genere
obj.onclick=function()
{
test(this.className);
}