<div class="month" data-month="3">
<div class="week">
<div class="day">
3
</div>
</div>
</div>
<div class="month" data-month="4">
<div class="week">
<div class="day">
13
</div>
</div>
</div>
<script>
var days = document.querySelectorAll('.day');
for(var i=0; i < days.length; i++) {
alert( days[i].parentNode.parentNode.getAttribute('data-month'));
}
</script>