Firstly using jQuery you should attach click() handlers rather than use antiquated onclick attributes. Then you can use the this keyword in the manner you have in your function.
Try this:
<div class="className"></div>
<div id="idName"></div>
<div name="attrName"></div>
$(function() {
$("div").click(function() {
var name = this.name;
var cls = this.className;
var id= this.id;
alert("Name: " + name + " / Class: " + cls + " / Id: " + id);
});
});
Example fiddle
The attributes you've selected are all available through POJS, you could also convert this to a jQuery object to get other attributes, for example:
var title = $(this).attr('title');
var myattribute = $(this).data('myattribute'); // using HTML5: <div data-myattribute="foo"></div>