<body onload=aa()>
<table id="myTable">
<tr>
<td>
<table id="firstHalf">
1
</table>
</td>
<div>
<table id="secondHalf">
2
</table>
</div>
<td>
</td>
</tr>
</table>
</bodY>
<script>
function aa()
{
var mytable = document.getElementById("myTable");
alert(mytable.childNodes[0].childNodes[0].childNodes[0].childNodes[0].id)
}
</script>
<table id="myTable">
<tr>
<td>
<table id="firstHalf">
1
</table>
</td>
<div>
<table id="secondHalf">
2
</table>
</div>
<td>
</td>
</tr>
</table>
</bodY>
<script>
function aa()
{
var mytable = document.getElementById("myTable");
alert(mytable.childNodes[0].childNodes[0].childNodes[0].childNodes[0].id)
}
</script>
<table id="myTable">
<tr>
<td>
<table id="firstHalf">
1
</table>
</td>
<div>
<table id="secondHalf">
2
</table>
</div>
<td>
</td>
</tr>
</table>
</bodY>
<script>
function aa()
{
var mytable = document.getElementById("myTable");
alert(mytable.children[0].children[0].children[0].children[0].id)
}
</script>
<body onload=aa()>
<table id="myTable">
<tr>
<td>
<table id="firstHalf">
1
</table>
</td>
<div>
<table id="secondHalf">
2
</table>
</div>
<td>
</td>
</tr>
</table>
</bodY>
<script>
function aa()
{
var mytable = document.getElementById("myTable");
alert(mytable.rows[0].cells[0].childNodes[0].id)
}
</script>