<body>
<style>
.first {background: red}
.second {background: green}
.third {background: blue}
</style>
<div id="myDiv">
<div class="first">1</div>
<div class="second">2</div>
<div class="third">3</div>
</div>
<script>
myDiv.onclick = function (event) {
event = event || window.event;
target = event.target || event.srcElement;
alert(target.className)
}
</script>
Имена классов с цифр не начинайте.