<table id="example">
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
</table>
<script>
document.getElementById("example").onclick = function (event) {
event = event || window.event;
var target = event.target || event.srcElement;
if (target.tagName == "TD") {
alert(target.innerHTML);
}
};
</script><table id="example" class="tftable" border="1">
<tr><th>Время</th><th>Понедельник</th><th>Вторник</th><th>Среда</th><th>Четверг</th><th>Пятница</th><th>Суббота</th><th>Воскресенье</th></tr>
<tr><td>10:00 - 11:00</td>
<?php foreach($arResult as $key => $person): ?>
<td>
<?
if ($person['Q10'] == 'N') {echo '<span style="color:green">'."СВОБОДНО".'</span>';}
else { echo '<span style="color:red">'."ЗАНЯТО".'</span>';}?>
</td>
<?php endforeach ?></tr>
<tr><td>11:00 - 12:00</td>
<?php foreach($arResult as $key => $person): ?>
<td>
<?
if ($person['Q11'] == 'N') {echo '<span style="color:green">'."СВОБОДНО".'</span>';}
else { echo '<span style="color:red">'."ЗАНЯТО".'</span>';}?>
</td>
<?php endforeach ?></tr>
<tr><td>12:00 - 13:00</td>
<?php foreach($arResult as $key => $person): ?>
<td>
<?
if ($person['Q12'] == 'N') {echo '<span style="color:green">'."СВОБОДНО
".'</a></span>';}
else { echo '<span style="color:red">'."ЗАНЯТО".'</span>';}?>
</td>
<?php endforeach ?></tr>
<tr><td>13:00 - 14:00</td>
<?php foreach($arResult as $key => $person): ?>
<td>
<?
if ($person['Q13'] == 'N') {echo '<span style="color:green">'."СВОБОДНО".'</span>';}
else { echo '<span style="color:red">'."ЗАНЯТО".'</span>';}?>
</td>
<?php endforeach ?></tr>
<tr><td>14:00 - 15:00</td>
<?php foreach($arResult as $key => $person): ?>
<td>
<?
if ($person['Q14'] == 'N') {echo '<span style="color:green">'."СВОБОДНО".'</span>';}
else { echo '<span style="color:red">'."ЗАНЯТО".'</span>';}?>
</td>
<?php endforeach ?></tr>
<tr><td>15:00 - 16:00</td>
<?php foreach($arResult as $key => $person): ?>
<td>
<?
if ($person['Q15'] == 'N') {echo '<span style="color:green">'."СВОБОДНО".'</span>';}
else { echo '<span style="color:red">'."ЗАНЯТО".'</span>';}?>
</td>
<?php endforeach ?></tr>
<tr><td>16:00 - 17:00</td>
<?php foreach($arResult as $key => $person): ?>
<td>
<?
if ($person['Q16'] == 'N') {echo '<span style="color:green">'."СВОБОДНО".'</span>';}
else { echo '<span style="color:red">'."ЗАНЯТО".'</span>';}?>
</td>
<?php endforeach ?></tr>
<tr><td>17:00 - 18:00</td>
<?php foreach($arResult as $key => $person): ?>
<td>
<?
if ($person['Q17'] == 'N') {echo '<span style="color:green">'."СВОБОДНО".'</span>';}
else { echo '<span style="color:red">'."ЗАНЯТО".'</span>';}?>
</td>
<?php endforeach ?></tr>
<tr><td>18:00 - 19:00</td>
<?php foreach($arResult as $key => $person): ?>
<td>
<?
if ($person['Q18'] == 'N') {echo '<span style="color:green">'."СВОБОДНО".'</span>';}
else { echo '<span style="color:red">'."ЗАНЯТО".'</span>';}?>
</td>
<?php endforeach ?></tr>
<tr><td>19:00 - 20:00</td>
<?php foreach($arResult as $key => $person): ?>
<td>
<?
if ($person['Q19'] == 'N') {echo '<span style="color:green">'."СВОБОДНО".'</span>';}
else { echo '<span style="color:red">'."ЗАНЯТО".'</span>';}?>
</td>
<?php endforeach ?></tr>
</table>