<body>
<table id = "myTable" border="1">
    <tbody id = "myTableBody"></tbody>
</table>
<script type="text/javascript">
var cell = document.createElement("td").appendChild(document.createTextNode("foo"));
var row = document.createElement("tr").appendChild(cell);
document.getElementById("myTableBody").appendChild(row);
</script>
</body>
为什么在IE中显示不出来?

解决方案 »

  1.   

    勸lz弄懂一下html=======================我懂!
      

  2.   

    <script>
    function fnAppend(){
    var cell = document.createElement("<TD>");
    var row = document.createElement("<TR>");
    document.getElementById("myTableBody").appendChild(row);
    row.appendChild(cell);
    cell.appendChild(document.createTextNode("foo"));}
    </script><body>
    <table id = "myTable" border="1">
    <tbody id="myTableBody">
    </tbody>
    </table><INPUT
       TYPE = "button"
       VALUE = "Append Child"
       onclick = "fnAppend()">
    </body>
      

  3.   

    <script>
    function fnAppend(){
    var cell = document.createElement("<TD>");
    var row = document.createElement("<TR>");
    myTableBody.appendChild(row);
    row.appendChild(cell);
    cell.innerText="foo";}
    </script><body>
    <table id = "myTable" border="1">
    <tbody id="myTableBody">
    </tbody>
    </table><INPUT
       TYPE = "button"
       VALUE = "Append Child"
       onclick = "fnAppend()">
    </body>