js实现无刷新评论

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">

        function noupdate() {
          var name=  document.getElementById("name").value;
          var text = document.getElementById("txt").value;
          var table = document.getElementById("tableLinks");

          var tr = document.createElement("tr");

          var td = document.createElement("td");


          td.innerHTML = name+":"+text ;

          tr.appendChild(td);

          table.appendChild(tr);
        };
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
         <table id="tableLinks">
        
            <tr>
                <td>
                    猫猫:
                </td>
                <td>
                    沙发耶!
                </td>
            </tr>
            
        </table>
        昵称:<input type="text" id="name" /><br />
        <textarea id="txt"></textarea><br />
        <input type="button" value="评论" onclick="noupdate()"/>
    </div>
    </form>
</body>
</html>
原文地址:https://www.cnblogs.com/anbylau2130/p/3123228.html