<table id="table"> <tr> <td>1</td><td>2</td> </tr> <tr> <td>3</td><td>4</td> </tr> </table> <script> var td = document.getElementById("table").getElementsByTagName("td"); for (var i=0; i<td.length; ++i) alert(td[i].innerHTML); </script>