javascript does not flush the comment implementation method

  • 2020-06-15 07:35:40
  • OfStack

This article gives an example of how javascript is implemented without refreshing comments. Share to everybody for everybody reference. Specific implementation methods are as follows:


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> No refresh comment </title>
<script type="text/javascript">
function AppendComment() {
 // Gets the value of the nickname text box 
 var nicknameValue = document.getElementById("nickName").value;
 // Gets the value of the comment text box 
 var commentValue = document.getElementById("comment").value;
 var tblComment = document.getElementById("tblComment");
 var tr = tblComment.tBodies[0].insertRow(-1);
 var tdNickName = tr.insertCell(-1);
 tdNickName.innerHTML = nicknameValue;
 var tdComment = tr.insertCell(-1);
 tdComment.innerHTML = commentValue;
}
</script>
</head>
<body>
  The home of the script <br />
  There is a rich script tutorial, please visit 
 <p> comments </p>
 <table id="tblComment" border="1">
 <tbody>
 <tr><td> Li mo :</td><td> Very good website </td></tr>
 </tbody>
 </table>
  nickname :<input type="text" id="nickName" /><br />
  comments :<textarea id="comment"></textarea><br />
 <input type="button" value=" comments " onclick="AppendComment()" />
</body>
</html>

Hopefully, this article has been helpful in your javascript programming.


Related articles: