for(i=0;i<document.getElementById("tmp").cells.length;i++)
alert(document.getElementById("tmp").cells[i].children[0].type)

解决方案 »

  1.   

    <table>
     <tr id="ttt">
       <td><input type="checkbox">s1</td>
       <td><input type="checkbox">s2</td>
       <td><input type="checkbox">s3</td>
     </tr>
     <tr id="tmp">
       <td><input type="checkbox">s4</td>
       <td><input type="checkbox">s5</td>
       <td><input type="checkbox">s6</td>
     </tr>
    </table>
    <input onclick=a() type=button value="Test">
    <script>
    function a()
    {
    for(i=0;i<document.getElementById("tmp").cells.length;i++)
    {
    alert(document.getElementById("tmp").cells[i].childNodes[0].type)
    alert(document.getElementById("tmp").cells[i].childNodes[1].nodeValue)
    }
    }
    </script>