<div id="test">
<div>0</div>
<div class="play">1</div>
<div class="play">2</div>
<div class="play">3</div>
<div class="play">4</div>
<div class="play">5</div>
</div>
<script>
window.onload = function () {
test.onclick = function (e) {
var el = e ? e.target : window.event.srcElement;
while (el !== this) {
if (el.className == "play") {
alert(el.innerHTML);
break;
}
el = el.parentNode;
}
};
};
</script>
разбирайся с примером