Чтобы конкретно ответить на ваш вопрос, используйте this
в этом контексте:
<table>
<tr onclick="this.className='test';alert(this.className);">
<td>Click me (I will replace the className)</td>
</tr>
<tr onclick="this.className+=' test';alert(this.className);">
<td>Click me to add (I will add to the className, click more than once)</td>
</tr>
<tr class="test">
<td>Click me for jQuery handler (I will only add classes once when clicked more than once)</td>
</tr>
</table>
$('.test').click(function(){
$(this).addClass('test'); // Note, will not add the same class more than once
alert(this.className);
});
http://jsfiddle.net/userdude/NBU8L/
Если вы используете jQuery, я бы избежал встроенных обработчиков и использовал для этого обработчики jQuery:
$('.gradeA').click(function(){
$(this).addClass('diagram-popup')
.popupWindow({
centerBrowser:1,
height:560,
width:1024
});
});