求一段显示动态表格的代码!

解决方案 »

  1.   


    <html> <head> 
    <meta http-equiv= "Content-Type"   content= "text/html;charset=gb2312"> 
    <title> replaceHref </title> 
    </head>
     <script language="javascript">
    function mb()
    {
    var t = document.createElement("table");
    t.border = "1";
    t.width = "250";
    t.height = "35";
    var tb = document.createElement("tbody");
    t.appendChild(tb)
    var tr = document.createElement("tr");
    tb.appendChild(tr);
    var td = document.createElement("td");
    td.id="td1";
    tr.appendChild(td);

    document.body.appendChild(t);
    document.getElementById("td1").innerText = "测试";
    //document.getElementById("txt").value = document.body.innerHTML; onload="mb()"
    }
    </script> 
    <body><a href="javascript:mb()">显示表格</a>
    </body> </html>