Home > Web Front-end > JS Tutorial > JavaScript non-refresh comment implementation method_javascript skills

JavaScript non-refresh comment implementation method_javascript skills

WBOY
Release: 2016-05-16 15:59:19
Original
1235 people have browsed it

The example in this article describes the implementation method of javascript non-refresh comments. Share it with everyone for your reference. The specific implementation method is as follows:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无刷新评论</title>
<script type="text/javascript">
function AppendComment() {
 //获取昵称文本框的值
 var nicknameValue = document.getElementById("nickName").value;
 //获取评论文本框的值
 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>
 脚本之家<br />
 里面有丰富的脚本教程,欢迎访问
 <p>评论</p>
 <table id="tblComment" border="1">
 <tbody>
 <tr><td>李莫:</td><td>非常好的网站</td></tr>
 </tbody>
 </table>
 昵称:<input type="text" id="nickName" /><br />
 评论:<textarea id="comment"></textarea><br />
 <input type="button" value="评论" onclick="AppendComment()" />
</body>
</html>
Copy after login

I hope this article will be helpful to everyone’s JavaScript programming design.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template